-
Notifications
You must be signed in to change notification settings - Fork 0
/
runscript.sh
executable file
·51 lines (41 loc) · 1.31 KB
/
runscript.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
#!/bin/sh
#Set Environment
export DJANGO_SETTINGS_MODULE=gladminds.dev_settings
#bin/django collectstatic
# Pull latest code changes from Github
#git pull origin master
# Run buildout
bin/buildout
# Synchromize database
bin/django syncdb
# Run collectstatic
echo yes |bin/django collectstatic
# Load the SMS Template
bin/django loaddata etc/data/template.json
# TODO: Stop already running server
output=`ps aux | grep "bin/django r[u]nserver 0.0.0.0:8000"`
set -- $output
pid=$2
echo "Stopping gladminds (PID $pid) ..."
kill $pid
sleep 2
kill -9 $pid >/dev/null 2>&1
sleep 5
echo "Stopped gladminds"
#Stopped Celery
echo Stopping celery and celery beat ..
ps -ef | grep celery | grep -v grep | awk '{print $2}' | xargs kill -9 > /dev/null 2>&1
sleep 3
#Starting Celery and Celery beat ...
echo Starting Celery and Celery beat ...
nohup bin/django celery -A gladminds worker --loglevel info -f tasks.out --settings=$DJANGO_SETTINGS_MODULE & > /dev/null 2>&1
nohup bin/django celery -A gladminds beat -S djcelery.schedulers.DatabaseScheduler --loglevel info -f beat.out --settings=$DJANGO_SETTINGS_MODULE & > /dev/null 2>&1
sleep 5
# Run server
echo "Starting gladminds ..."
nohup bin/fab runserver &
sleep 5
output=`ps aux | grep "bin/django r[u]nserver 0.0.0.0:8000"`
set -- $output
pid=$2
echo "Started gladminds (PID $pid)"