#!/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