-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrunscript.sh
More file actions
executable file
·39 lines (32 loc) · 812 Bytes
/
runscript.sh
File metadata and controls
executable file
·39 lines (32 loc) · 812 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
37
38
39
#!/bin/bash
PYTHON=python3
TAGFILE=".update"
UPDATECODE=10
RESTARTCODE=11
SIMULATE=1 # 0 for true
exitcode=-1
while [[ ${exitcode} -ne 0 ]]; do
${PYTHON} -m pip install -r requirements.txt
${PYTHON} Geckarbot.py ${exitcode}
exitcode=$?
# update
if [[ ${exitcode} -eq ${UPDATECODE} ]]; then
if [[ ${SIMULATE} -ne 0 ]]; then
git fetch origin release --tags --force
git checkout tags/$(cat ${TAGFILE})
else
echo "Simulating update to $(cat ${TAGFILE})"
fi
continue
fi
# restart
if [[ ${exitcode} -eq ${RESTARTCODE} ]]; then
continue
fi
# anything else
if [[ ${exitcode} -ne 0 ]]; then
echo "Unexpected Bot exit code: ${exitcode}"
fi
# give ctrl+c a chance
sleep 1
done