From 84b8daeec46bd0b073e8fa3a36847531eaf3ef4f Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 10 Jul 2024 15:45:57 -0700 Subject: [PATCH] installerChange --- .gitignore | 3 +++ etc/{mesh_bot.service => mesh_bot.tmp} | 6 +++--- etc/{pong_bot.service => pong_bot.tmp} | 0 install.sh | 7 +++++++ 4 files changed, 13 insertions(+), 3 deletions(-) rename etc/{mesh_bot.service => mesh_bot.tmp} (70%) rename etc/{pong_bot.service => pong_bot.tmp} (100%) diff --git a/.gitignore b/.gitignore index f3857c4..cc166e9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ bbsdb.pkl # virtualenv venv/ + +# modified .service files +etc/*.service diff --git a/etc/mesh_bot.service b/etc/mesh_bot.tmp similarity index 70% rename from etc/mesh_bot.service rename to etc/mesh_bot.tmp index 1c3229f..13496df 100644 --- a/etc/mesh_bot.service +++ b/etc/mesh_bot.tmp @@ -1,13 +1,13 @@ -# /etc/systemd/system/meshbot.service +# /etc/systemd/system/mesh_bot.service # sudo systemctl daemon-reload -# sudo systemctl start meshbot.service +# sudo systemctl start mesh_bot.service [Unit] Description=MESH-BOT After=network.target [Service] -ExecStart=/usr/bin/python /usr/local/meshing-around/mesh_bot.py +ExecStart=/usr/bin/python /dir/launch.sh mesh # Disable Python's buffering of STDOUT and STDERR, so that output from the # service shows up immediately in systemd's logs diff --git a/etc/pong_bot.service b/etc/pong_bot.tmp similarity index 100% rename from etc/pong_bot.service rename to etc/pong_bot.tmp diff --git a/install.sh b/install.sh index 902572e..1dc6bed 100755 --- a/install.sh +++ b/install.sh @@ -35,6 +35,13 @@ read bot # reminder to change the .service file to proper path for the bot +#set the correct path in the service file +program_path="$(dirname "$0")" +cp etc/pong_bot.service.tmp etc/pong_bot.service +cp etc/mesh_bot.service.tmp etc/mesh_bot.service +sed -i "s|/dir/launch.sh|$program_path/launch.sh|g" etc/pong_bot.service +sed -i "s|/dir/launch.sh|$program_path/launch.sh|g" etc/mesh_bot.service + if [ $bot == "pong" ]; then # install service for pong bot sudo cp etc/pong_bot.service /etc/systemd/system/