-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstart.sh
executable file
·49 lines (40 loc) · 1.12 KB
/
start.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Pretty much copy-pasted from reddit-xkcdbot, with slight changes
# Kill statuscheck
export STATUSPID=`ps aux | grep 'statuscheck.py' | grep -v grep | awk '{print($2)}'`
if [ -n "$STATUSPID" ]; then
echo "Killing old statuscheck "$STATUSPID"."
kill $STATUSPID
fi
# Kill if started
export SAKURAIPID=`ps aux | grep '__init__.py' | grep -v grep | awk '{print($2)}'`
if [ -n "$SAKURAIPID" ]; then
echo "Killing old process "$SAKURAIPID"."
kill $SAKURAIPID
fi
# Update from git
echo "Pulling latest git version"
git pull
# Start
echo "Starting"
cd src
nohup python3 __init__.py --miiverse >../nohup.out 2>&1 &
disown
sleep 1
export SAKURAIPID=`ps aux | grep '__init__.py' | grep -v grep | awk '{print($2)}'`
if [ -n "$SAKURAIPID" ]; then
echo "Running correctly."
else
echo "ERROR: Script stopped."
fi
# Start statuscheck
echo "Starting statuscheck"
nohup python3 statuscheck.py >../nohup.out 2>&1 &
disown
sleep 1
export STATUSPID=`ps aux | grep 'statuscheck.py' | grep -v grep | awk '{print($2)}'`
if [ -n "$STATUSPID" ]; then
echo "Statuscheck running correctly."
else
echo "ERROR: Statuscheck stopped."
fi