-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstartup.sh
More file actions
executable file
·48 lines (43 loc) · 1.2 KB
/
startup.sh
File metadata and controls
executable file
·48 lines (43 loc) · 1.2 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
local_config="http.conf"
nginx_config="/etc/nginx/conf.d/http.conf"
# start the mongo-deamon
if [ "$(systemctl is-active mongod)" != "active" ]
then
echo "starting service 'mongod'"
sudo service mongod start
else
echo "service 'mongod' is running"
fi
# check the nginX web-config-file
if [ "$(cmp $local_config $nginx_config)" != "" ]
then
echo "nginx config file changed!"
sudo cp "$local_config" "$nginx_config"
else
echo "nginx config did not change"
fi
# start the nginX-deamon
if [ "$(systemctl is-active nginx)" != "active" ]
then
echo "starting service 'nginx'"
sudo service nginx start
else
echo "service 'nginx' is running"
sudo nginx -s reload
fi
# start the certbot-timer
if [ "$(systemctl is-active certbot.timer)" != "active" ]
then
echo "starting service 'certbot.timer'"
sudo service certbot.timer start
else
echo "service 'certbot.timer' is running"
fi
# start the application itself (blocking)
source "env/bin/activate"
export PYTHONPATH=$PWD
# terminate all background processes if app/main.py is terminated
trap "kill 0" EXIT
# run app/dashboard/parser/data_daemon.py in background (check for new data every day at midnight)
python3 "app/dashboard/parser/data_daemon.py" &
python3 "app/main.py"