-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartBotLinux.sh
More file actions
83 lines (61 loc) · 1.58 KB
/
StartBotLinux.sh
File metadata and controls
83 lines (61 loc) · 1.58 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
runbot=1
reboot=0
progress_bar () {
dpkg -s bc &> /dev/null
if [ $? -ne 0 ]; then
if [ `whoami` != root ]; then
echo "FAIL: You are not root."
echo "Please run this script as root or using sudo"
exit
else
echo "Script is missing an important dependancy. Installing this dependancy now."
sleep 2
fi
local apt=`command -v apt-get`
local yum=`command -v yum`
if [ -n "$apt" ]; then
apt-get update
apt-get install -y bc
elif [ -n "$yum" ]; then
yum update
yum install -y bc
else
echo "Err: no path to apt-get or yum" >&2;
exit 1;
fi
echo "Done! Please restart this script."
exit 1;
fi
local waittime=$(echo "$1/50" | bc -l )
for i in {1..50} ; do
echo -n '['
for ((j=0; j<i; j++)) ; do echo -n '='; done
echo -n '=>'
for ((j=i; j<50; j++)) ; do echo -n ' '; done
if [ $i = 50 ]; then
echo -n "]" $'\n'
else
echo -n "]" $'\r'
fi
sleep $waittime
done
}
while [ $runbot -gt 0 ]
do
python3.7 runbot.py
while IFS= read -r line
do
if [ "$line" -eq "1" ]; then
reboot=1
else
runbot=0
fi
done < data/reboot.txt
if [ "$reboot" -eq 1 ]; then
echo -------------------- REBOOTING BOT --------------------
progress_bar 6
reboot=0
echo 0 > data/reboot.txt
fi
done