python - Celery daemon script not going in background with init script -



python - Celery daemon script not going in background with init script -

the celery docs says that

however, in production want run worker in background daemon.

i made init.d script below

#!/bin/sh # # chkconfig: 345 99 15 # description: celery init.d # chdir @ start. celeryd_chdir="/home/username/django/django_myapp" # how phone call "manage.py celeryd_multi" celeryd="/opt/python27/bin/python manage.py celeryd " #celeryd_multi="$celeryd_chdir/manage.py celeryd_multi" # arguments celeryd celeryd_opts="--time-limit 300 --concurrency=8" # name of celery config module. celery_config_module="celeryconfig" # %n replaced nodename. celeryd_log_file="/var/log/celery/%n.log" celeryd_pid_file="/var/run/celery/%n.pid" # workers should run unprivileged user. celeryd_user="root" celeryd_group="celery" # name of projects settings module. export django_settings_module="settings" celeryd_pidfile=/var/run/celery.pid # source function library. . /etc/init.d/functions # celery options celeryd_opts="-b -l info" if [ -n "$2" ]; celeryd_opts="$celeryd_opts $2" fi start () { cd $celeryd_chdir daemon --user $celeryd_user --pidfile $celeryd_pidfile $celeryd $celeryd_opts & } stop () { if [[ -s $celeryd_pidfile ]] ; echo "stopping celery" killproc -p $celeryd_pidfile python echo "done!" rm -f $celeryd_pidfile else echo "celery not running." fi } check_status() { status -p $celeryd_pidfile python } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) check_status ;; *) echo "usage: $0 {start|stop|restart|status}" exit 1 ;; esac

when execute /etc/init.d/celeryd start

now runs fine 1 time again in foreground not in background

is case or doing wrong

python django daemon django-celery

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -