forked from Charcoal-SE/SmokeDetector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nocrash.sh
58 lines (55 loc) · 917 Bytes
/
nocrash.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
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
read -p "Username: " u
export ChatExchangeU=$u
export CEU="h"
stty -echo
read -p "Password: " p
export ChatExchangeP=$p
stty echo
count=0
crashcount=0
stoprunning=0
while [ "$stoprunning" -eq "0" ]
do
if [ "$count" -eq "0" ]
then
python ws.py first_start
else
python ws.py
fi
ecode=$?
if [ "$ecode" -eq "3" ]
then
git checkout master
git pull
git submodule update
count=0
crashcount=0
elif [ "$ecode" -eq "4" ]
then
count=$((count+1))
sleep 5
if [ "$crashcount" -eq "2" ]
then
git checkout HEAD~1
count=0
crashcount=0
else
crashcount=$((crashcount+1))
fi
elif [ "$ecode" -eq "5" ]
then
count=0
elif [ "$ecode" -eq "6" ]
then
stoprunning=1
elif [ "$ecode" -eq "8" ]
then
git checkout master
count=0
crashcount=0
else
sleep 5
count=$((count+1))
fi
done