description "Celery daemon"
author "Roman Gorodeckij <holms@holms.lt>"
task
start on starting rc-sysinit
pre-start script
# Source virtualenv
. /var/www/shrinktheapp/bin/activate
# Source the config file
. /etc/default/celery
# Source application related env file
. /etc/environment
if [ ! -d ${CELERYD_LOG_DIR} ]; then
mkdir -p ${CELERYD_LOG_DIR}
chown "www":"www" ${CELERYD_LOG_DIR}
fi
if [ ! -d ${CELERY_RUN_DIR} ]; then
mkdir -p ${CELERYD_RUN_DIR}
chown "www":"www" ${CELERYD_RUN_DIR}
fi
/var/www/shrinktheapp/bin/celery multi start \
--pidfile=${CELERYD_PID_FILE} \
--logfile=${CELERYD_LOG_FILE} \
--loglevel=${CELERYD_LOG_LEVEL} \
--app=${CELERYD_APP} \
--workdir="/var/www/shrinktheapp/project" \
--uid=www \
--gid=www \
--beat \
${CELERYD_NODES} \
${CELERYD_OPTS}
end script
pre-stop script
for pidfile in /var/www/shrinktheapp/project/run/*.pid
do
kill $(cat $pidfile)
done
end script