pyrosrun.sh
1.85 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
80
81
82
83
84
85
86
#!/bin/bash
COMMANDS="\n
\t'server' : Runs the web server\n
\t'updatedb' : Update the database\n
\t'unittest' : Runs the tests that don't need celery\n
\t'test_all' : Run all the existing tests (this command needs to be updated when tests are added in the project)\n
\t'celery_on' : Starts the celery workers\n
\t'celery_off' : Stops the celery workers\n
\t'simul_on' : Starts the simulators\n
\t'simul_off' : Stops the simulators\n
\t'start' : Starts the simulators then the celery workers, then the web server\n
\t'stop' : Stops the celery workers then the simulators\n
\t'clean_logs' : Clear all pyros .log files from /logs"
NEEDED_COMMAND="One command is needed. Possible commands : $COMMANDS"
INVALID_COMMAND="Invalid command. Possible commands : $COMMANDS"
SCRIPT_PATH=$0
SCRIPT_PATH=${SCRIPT_PATH%/*}
cd $SCRIPT_PATH
source private/venv_py3_pyros/bin/activate
if [ $# -ne 1 ]; then
echo -e $NEEDED_COMMAND
exit
fi
cd src/
case "$1" in
"server")
python manage.py runserver
;;
"updatedb")
python manage.py makemigrations
python manage.py migrate
;;
"unittest")
scripts/test_all_usual.sh
;;
"test_all")
scripts/test_all_usual.sh
scripts/celery_test.sh alert_manager.tests.AlertListenerTestsCelery
# ADD HERE ALL THE CELERY TESTS
;;
"celery_on")
scripts/start_celery_workers.sh
;;
"celery_off")
scripts/kill_celery_workers.sh
;;
"simul_on")
cd ../simulators
./run_all.sh
cd -
;;
"simul_off")
cd ../simulators
./kill_all.sh
cd -
;;
"start")
cd ../simulators
./run_all.sh
cd -
scripts/start_celery_workers.sh
python manage.py runserver
;;
"stop")
scripts/kill_celery_workers.sh
cd ../simulators
./kill_all.sh
cd -
;;
"clean_logs")
cd ../logs
rm -f *.log
cd -
;;
*)
echo -e $INVALID_COMMAND
;;
esac