forked from SIlver--/remindmebot-reddit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
restart.sh
executable file
·28 lines (23 loc) · 1.06 KB
/
restart.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# restart.sh
#
# Script to check restart clashcallerbot scripts.
#
# Notes:
# * Remember to set executable mode with ``chmod +x ./restart.sh``
# * Script assumes files are in the `clashcallerbotreddit` directory.
# * If you have access to root, check the Docs for info on setting up systemd instead
# * Logfile can be removed if not necessary (remove variable and ``>> $logfile``)
# * ``python3`` can be replaced with relevant python version
# * The function in ``kill` returns all script PIDs, so it must be restarted.
# * If you have access to ``pidof``, you can avoid killing all script instances
#
python3='./env/bin/python3'
logfile='./logs/clashcallerbotlog.txt'
echo "Restarting reply.py: $(date)" >> $logfile
kill $(ps aux | grep '[p]ython3 -m clashcallerbotreddit.reply' | awk '{print $2}')
sleep 3
nohup $python3 -m clashcallerbotreddit.reply > /dev/null 2>&1 &
echo "Restarting search.py: $(date)" >> $logfile
kill $(ps aux | grep '[p]ython3 -m clashcallerbotreddit.search' | awk '{print $2}')
sleep 3
nohup $python3 -m clashcallerbotreddit.search > /dev/null 2>&1 &