-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·97 lines (79 loc) · 2.52 KB
/
run.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# Copyright (c) 2019-2024 Ramon van der Winkel.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
STATIC_DIR="Site/.static/"
SETTINGS_DEV="Site.settings_dev"
SETTINGS_NORMAL="Site.settings"
BG_DURATION=60 # minutes (60 is max voor de meeste commando's)
export PYTHONDONTWRITEBYTECODE=1
if [ "$1" = "--nodebug" ]
then
DEBUG=0
SETTINGS="$SETTINGS_NORMAL"
else
DEBUG=1
SETTINGS="$SETTINGS_DEV"
fi
echo "[INFO] Using config $SETTINGS"
echo "[INFO] Running system check"
CHECK=$(./manage.py check --settings="$SETTINGS")
RES=$?
if [ $RES -ne 0 ]
then
echo "$CHECK"
exit 1
fi
echo "[INFO] Refreshing static files"
rm -rf "$STATIC_DIR"* # keeps top directory
COLLECT=$(./manage.py collectstatic --link)
RES=$?
if [ $RES -ne 0 ]
then
echo "$COLLECT"
exit 1
fi
# start the background processes
echo "[INFO] Starting Mollie simulator"
pkill -f websim_betaal
python3 ./Betaal/test-tools/websim_betaal.py &
echo "[INFO] Starting Google Maps simulator"
pkill -f websim_gmaps
python3 ./Locatie/test_tools/websim_gmaps.py &
echo "[INFO] Starting betaal_mutaties (runtime: $BG_DURATION minutes)"
pkill -f betaal_mutaties
./manage.py betaal_mutaties --settings="$SETTINGS" $BG_DURATION &
echo "[INFO] Starting bestel_mutaties (runtime: $BG_DURATION minutes)"
pkill -f bestel_mutaties
./manage.py bestel_mutaties --settings="$SETTINGS" $BG_DURATION &
echo "[INFO] Starting regiocomp_mutaties (runtime: $BG_DURATION minutes)"
pkill -f regiocomp_mutaties
./manage.py regiocomp_mutaties --settings="$SETTINGS" $BG_DURATION &
echo "[INFO] Starting regiocomp_tussenstand (runtime: $BG_DURATION minutes)"
pkill -f regiocomp_tussenstand
./manage.py regiocomp_tussenstand --settings="$SETTINGS" $BG_DURATION &
echo "[INFO] Starting scheids_mutaties (runtime: $BG_DURATION minutes)"
pkill -f scheids_mutaties
./manage.py scheids_mutaties --settings="$SETTINGS" $BG_DURATION &
# wacht tot alle achtergrondtaken gestart zijn
sleep 0.8
# start the development webserver
EXTRA_ARGS=''
if [ $DEBUG -ne 1 ]
then
# run with DEBUG=False stops serving static files..
# using --insecure fixes that
EXTRA_ARGS="--insecure"
fi
echo "[INFO] Starting runserver"
./manage.py runserver --settings="$SETTINGS" --skip-checks $EXTRA_ARGS
# kill the background processes
echo "[INFO] Stopping background tasks"
pkill -f regiocomp_tussenstand
pkill -f regiocomp_mutaties
pkill -f bestel_mutaties
pkill -f betaal_mutaties
pkill -f scheids_mutaties
pkill -f websim_gmaps
pkill -f websim_betaal
# end of file