-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontorl_celery.sh
53 lines (50 loc) · 1.71 KB
/
contorl_celery.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
52
53
#celery -A Ops worker -l info
#!/bin/sh
#
case "$1" in
start)
celery multi start w1 -A Ops -l info --pidfile=/var/run/celery/%n.pid \
--logfile=/var/log/celery/%n.log
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PIDFILE=`ls /var/run/celery/*.pid`
PID=$(cat $PIDFILE)
echo "Stopping ..."
celery multi stop w1 -A Ops -l info --pidfile=/var/run/celery/%n.pid \
--logfile=/var/log/celery/%n.log
while [ -x /proc/${PID} ]
do
echo "Waiting for Celery to shutdown ..."
sleep 1
done
echo "Celery stopped"
fi
;;
restart)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PIDFILE=`ls /var/run/celery/*.pid`
PID=$(cat $PIDFILE)
echo "Stopping ..."
celery multi stop w1 -A Ops -l info --pidfile=/var/run/celery/%n.pid \
--logfile=/var/log/celery/%n.log
while [ -x /proc/${PID} ]
do
echo "Waiting for Celery to shutdown ..."
sleep 1
done
echo "Celery stopped"
fi
celery multi start w1 -A Ops -l info --pidfile=/var/run/celery/%n.pid \
--logfile=/var/log/celery/%n.log
;;
*)
echo "Please use start or stop as first argument"
;;
esac