From 8a022ae885ee0b26e066e308f334168b61baa5b8 Mon Sep 17 00:00:00 2001 From: Trent Bartlem Date: Tue, 4 Nov 2014 13:50:38 +1000 Subject: [PATCH] Running long-lived processes in the background, --- bootstrap.sh | 2 +- shutdown.sh | 3 +++ startup.sh | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100755 shutdown.sh diff --git a/bootstrap.sh b/bootstrap.sh index 3e2b9b86..c0058e56 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -29,7 +29,7 @@ sudo apt-get -y install rabbitmq-server sudo pip install -r requirements.txt -chmod +x startup.sh +chmod +x *.sh echo '--------' echo 'This would be a good point to adjust mysql passwords, as well as all the stuff ' diff --git a/shutdown.sh b/shutdown.sh new file mode 100755 index 00000000..4743ed09 --- /dev/null +++ b/shutdown.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +ps ww | grep 'manage.py' | grep -v grep | awk '{print $1}' | xargs kill diff --git a/startup.sh b/startup.sh index 8b854739..54999021 100755 --- a/startup.sh +++ b/startup.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash + +# TODO route log output to file. python manage.py syncdb python manage.py shell < run_alliance_corp_update.py -python manage.py celeryd --verbosity=2 --loglevel=DEBUG -python manage.py celerybeat --verbosity=2 --loglevel=DEBUG -python manage.py runserver +python manage.py celeryd --verbosity=2 --loglevel=DEBUG & +python manage.py celerybeat --verbosity=2 --loglevel=DEBUG & + +python manage.py runserver &