add deamon service

This commit is contained in:
Dmitry Afanasyev 2022-08-08 16:33:59 +03:00
parent da0fb1a090
commit f79e3ff861
3 changed files with 22 additions and 0 deletions

View File

@ -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

6
scripts/shutdown-bot.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
echo "shutting down the bot"
bash killall python;
bash killall firefox;

5
scripts/start-bot.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
echo "starting the bot"
cd /opt/mosgortrans && poetry shell && python main.py