-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
37 lines (25 loc) · 743 Bytes
/
Copy pathdeploy.sh
File metadata and controls
37 lines (25 loc) · 743 Bytes
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
29
30
31
32
33
34
35
36
#!/bin/bash
# cd to repository
cd ~/grovebot/
git reset --hard HEAD # discard local changes
git pull origin master # pull new changes
# find last created PID from file and kill it
while read -r line || [[ -n "$line" ]]; do
echo "attempting to kill process id: $line"
kill -9 $line
done < "../grovebot/PID"
echo "kill successful or no such process was found"
# delete any existing PID_last files
if [ -e ../grovebot/PID_last ] ; then
echo "removing old PID_last"
rm -f ../grovebot/PID_last
fi
# rename old PID file for debug purposes
if [ -e PID ] ; then
echo "changing old PID to PID_last"
mv PID PID_last
fi
echo "starting bot..."
nohup python3 main.py > /dev/null 2>&1 & echo $! > PID
echo "bot started."
echo "done"