Blame view

pyrosrun.sh 1.85 KB
42983157   haribo   #3443 pyrosrun sc...
1
2
#!/bin/bash

0f60ca69   haribo   pyrosrun script u...
3
4
5
6
7
8
9
10
11
12
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
d91a4c2b   Jeremy   Inserted logger
13
\t'stop' : Stops the celery workers then the simulators\n
b5e9fde1   Jeremy   Update django ver...
14
\t'clean_logs' : Clear all pyros .log files from /logs"
0f60ca69   haribo   pyrosrun script u...
15

00bc9770   Etienne Pallier   fix pyrosrun
16
17
NEEDED_COMMAND="One command is needed. Possible commands : $COMMANDS"
INVALID_COMMAND="Invalid command. Possible commands : $COMMANDS"
0f60ca69   haribo   pyrosrun script u...
18
19
20
21
22

SCRIPT_PATH=$0
SCRIPT_PATH=${SCRIPT_PATH%/*}

cd $SCRIPT_PATH
42983157   haribo   #3443 pyrosrun sc...
23

419720e2   carens_p   pyrosrun.sh
24
source private/venv_py3_pyros/bin/activate
42983157   haribo   #3443 pyrosrun sc...
25
26

if [ $# -ne 1 ]; then
0f60ca69   haribo   pyrosrun script u...
27
   echo -e $NEEDED_COMMAND
42983157   haribo   #3443 pyrosrun sc...
28
29
30
31
32
33
34
35
36
   exit
fi

cd src/

case "$1" in
     "server")
	python manage.py runserver
	;;
0f60ca69   haribo   pyrosrun script u...
37
     "updatedb")
984e74ea   haribo   Moving non-app di...
38
39
40
	python manage.py makemigrations
	python manage.py migrate
	;;
0f60ca69   haribo   pyrosrun script u...
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
     "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 -
	;;
b5e9fde1   Jeremy   Update django ver...
78
     "clean_logs")
d91a4c2b   Jeremy   Inserted logger
79
80
81
82
     cd ../logs
     rm -f *.log
     cd -
	;;
42983157   haribo   #3443 pyrosrun sc...
83
     *)
0f60ca69   haribo   pyrosrun script u...
84
	echo -e $INVALID_COMMAND
42983157   haribo   #3443 pyrosrun sc...
85
86
	;;
esac