This commit is contained in:
SpudGunMan
2024-09-25 21:58:34 -07:00
parent dd8357453b
commit 75cf43e02a
3 changed files with 18 additions and 0 deletions
+4
View File
@@ -7,8 +7,12 @@ Description=MESH-BOT
After=network.target
[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/dir/
ExecStart=/usr/bin/bash python3 mesh_bot.py
ExecStop=/usr/bin/bash pkill -f mesh_bot.py
# Disable Python's buffering of STDOUT and STDERR, so that output from the
# service shows up immediately in systemd's logs
+4
View File
@@ -7,8 +7,12 @@ Description=PONG-BOT
After=network.target
[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/dir/
ExecStart=/usr/bin/bash python3 pong_bot.py
ExecStop=/usr/bin/bash pkill -f pong_bot.py
# Disable Python's buffering of STDOUT and STDERR, so that output from the
# service shows up immediately in systemd's logs
+10
View File
@@ -62,6 +62,10 @@ if [ $venv == "y" ]; then
sed -i $replace etc/mesh_bot.service
replace="python3 pong_bot.py|/dir/launch.sh pong"
sed -i $replace etc/pong_bot.service
replace="pkill -f mesh_bot.py|pkill -f launch.sh"
sed -i $replace etc/mesh_bot.service
replace="pkill -f pong_bot.py|pkill -f launch.sh"
sed -i $replace etc/pong_bot.service
# install dependencies
pip install -U -r requirements.txt
@@ -86,9 +90,15 @@ read bot
program_path=$(pwd)
cp etc/pong_bot.tmp etc/pong_bot.service
cp etc/mesh_bot.tmp etc/mesh_bot.service
# set the correct path in the service file
replace="s|/dir/|$program_path/|g"
sed -i $replace etc/pong_bot.service
sed -i $replace etc/mesh_bot.service
# set the correct user in the service file?
whoami=$(whoami)
replace="s|user=pi|user=$whoami|g"
sed -i $replace etc/pong_bot.service
sed -i $replace etc/mesh_bot.service
printf "\n service files updated\n"
# ask if emoji font should be installed for linux