diff --git a/scripts/mosgortrans.service b/scripts/mosgortrans.service new file mode 100644 index 0000000..6941ecd --- /dev/null +++ b/scripts/mosgortrans.service @@ -0,0 +1,11 @@ +[Unit] +Description=MosGorTrans bot +After=network.target + +[Service] +Restart=always +WorkingDirectory=/opt/mosgortrans +ExecStart=scripts/start-bot.sh +ExecStop=scripts/shutdown-bot.sh +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/scripts/shutdown-bot.sh b/scripts/shutdown-bot.sh new file mode 100644 index 0000000..44a725b --- /dev/null +++ b/scripts/shutdown-bot.sh @@ -0,0 +1,6 @@ +#!/bin/bash + + +echo "shutting down the bot" +bash killall python; +bash killall firefox; \ No newline at end of file diff --git a/scripts/start-bot.sh b/scripts/start-bot.sh new file mode 100644 index 0000000..45923c2 --- /dev/null +++ b/scripts/start-bot.sh @@ -0,0 +1,5 @@ +#!/bin/bash + + +echo "starting the bot" +cd /opt/mosgortrans && poetry shell && python main.py \ No newline at end of file