forked from sshnaidm/sova
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·42 lines (39 loc) · 925 Bytes
/
entrypoint.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
#!/bin/bash
function install_crontab {
pkill crond
crontab -l > /tmp/old_crontab
diff -q >/dev/null /app/crontab /tmp/old_crontab || cat /app/crontab | crontab -
crond -L /cidata/logs/cron.log
}
while getopts 'hdp' flag; do
case "${flag}" in
h)
echo "options:"
echo "-h show brief help"
echo "-d debug mode, flask debug server"
echo "-p production mode with uwsgi"
exit 0
;;
d)
touch /debug1
;;
p)
touch /prod
;;
*)
break
;;
esac
done
mkdir -p /cidata/logs
if [ -e /debug1 ]; then
echo "Running app in debug mode!"
exec python flaskapp.py
elif [ -e /prod ]; then
echo "Running app in production mode!"
touch /cidata/index.html
install_crontab
exec uwsgi --ini /uwsgi.ini
else
exec /bin/bash
fi