I'm not running a Django Project, this is just a simple python project and I want to demonize the celery. Initially I was running it in the shell. Celery sometimes hangs in between(known issue). Hence I need to restart it again and again. Therefore, I need to daemonize it, so that I can run a script that restarts the celery on its own via a cronjob.
I've looked onto various threads on SO, but with no luck.
I've created a user and group , both named as celery by following commands:-
sudo groupadd celery
sudo useradd -g celery celery
I created this file as: /etc/default/celeryd
CELERYD_NODES="w1"
CELERY_BIN="/usr/local/bin/celery"
CELERY_APP="tasks"
CELERYD_CHDIR="/home/cube26/Desktop/cube26/c26-quicklook"
CELERYD_OPTS="--time-limit=300 --concurrency=8 -Q BBC,BGR,FASTCOMPANY"
CELERY_CONFIG_MODULE="celeryconfig" #I dont know what this is for?
CELERYD_LOG_FILE="/var/log/celery/%n.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
CELERY_CREATE_DIRS=1
CELERYD_USER="celery"
CELERYD_GROUP="celery"
Then downloaded this file and kept it inside /etc/init.d/celeryd.
Then chmod +x /etc/init.d/celeryd to make it executable.
Thats all I did.
and I'm still getting an error saying IOError: [Errno 13] Permission denied: '/var/log/celery/w1.log'
What wrong am I doing? Please help me rectify it.
/var/log/celeryand who is the owner? The simplest way to check is runls -la /var/log//var/log/celeryI didls -la /var/log/celery, and it resulted it with the following outputdrwxr-sr-x 2 celery celery 4096 Mar 3 11:56 .drwxrwxr-x 23 root syslog 4096 Mar 3 11:25 ..` -rw-r--r-- 1 root root 0 Mar 3 11:25 celery.log`-rw-r--r-- 1 root root 0 Mar 3 11:29 w1.log/var/log/celery/w1.logor change it permisions:chown -R celery:celery /var/log/celery/[Errno 13] Permission denied: '/var/run/celery/w1.pid'