Adding python3 virtualenv to python systemd services
This commit is contained in:
@@ -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
|
||||||
@@ -116,7 +118,7 @@ create_necessary_dirs() {
|
|||||||
|
|
||||||
sudo -u ${USER} ln -fs $my_dir/exclude_species_list.txt $my_dir/scripts
|
sudo -u ${USER} ln -fs $my_dir/exclude_species_list.txt $my_dir/scripts
|
||||||
sudo -u ${USER} ln -fs $my_dir/include_species_list.txt $my_dir/scripts
|
sudo -u ${USER} ln -fs $my_dir/include_species_list.txt $my_dir/scripts
|
||||||
sudo -u ${USER} ln -fs $my_dir/homepage/* ${EXTRACTED}
|
sudo -u ${USER} ln -fs $my_dir/homepage/* ${EXTRACTED}
|
||||||
sudo -u ${USER} ln -fs $my_dir/model/labels.txt ${my_dir}/scripts
|
sudo -u ${USER} ln -fs $my_dir/model/labels.txt ${my_dir}/scripts
|
||||||
sudo -u ${USER} ln -fs $my_dir/scripts ${EXTRACTED}
|
sudo -u ${USER} ln -fs $my_dir/scripts ${EXTRACTED}
|
||||||
sudo -u ${USER} ln -fs $my_dir/scripts/play.php ${EXTRACTED}
|
sudo -u ${USER} ln -fs $my_dir/scripts/play.php ${EXTRACTED}
|
||||||
@@ -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
|
||||||
@@ -386,7 +388,7 @@ install_phpsysinfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config_icecast() {
|
config_icecast() {
|
||||||
if [ -f /etc/icecast2/icecast.xml ];then
|
if [ -f /etc/icecast2/icecast.xml ];then
|
||||||
cp /etc/icecast2/icecast.xml{,.prebirdnetpi}
|
cp /etc/icecast2/icecast.xml{,.prebirdnetpi}
|
||||||
fi
|
fi
|
||||||
sed -i 's/>admin</>birdnet</g' /etc/icecast2/icecast.xml
|
sed -i 's/>admin</>birdnet</g' /etc/icecast2/icecast.xml
|
||||||
@@ -451,7 +453,7 @@ install_services() {
|
|||||||
USER=$USER HOME=$HOME ${my_dir}/scripts/createdb.sh
|
USER=$USER HOME=$HOME ${my_dir}/scripts/createdb.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f ${config_file} ];then
|
if [ -f ${config_file} ];then
|
||||||
source ${config_file}
|
source ${config_file}
|
||||||
install_services
|
install_services
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user