Adding python3 virtualenv to python systemd services

This commit is contained in:
Jake Herbst
2022-05-16 21:46:05 -04:00
parent b136e07b51
commit 670d3f90ca
+4 -2
View File
@@ -9,6 +9,8 @@ config_file=$my_dir/birdnet.conf
export USER=$USER export USER=$USER
export HOME=$HOME export HOME=$HOME
export PYTHON_VIRTUAL_ENV="$HOME/BirdNET-Pi/birdnet/bin/python3"
install_depends() { install_depends() {
apt install -y debian-keyring debian-archive-keyring apt-transport-https apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
@@ -66,7 +68,7 @@ Restart=always
Type=simple Type=simple
RestartSec=10 RestartSec=10
User=${USER} User=${USER}
ExecStart=/usr/local/bin/server.py ExecStart=$PYTHON_VIRTUAL_ENV /usr/local/bin/server.py
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
@@ -325,7 +327,7 @@ Restart=always
RestartSec=120 RestartSec=120
Type=simple Type=simple
User=$USER User=$USER
ExecStart=/usr/local/bin/daily_plot.py ExecStart=$PYTHON_VIRTUAL_ENV /usr/local/bin/daily_plot.py
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF