Skip to content

Instantly share code, notes, and snippets.

@riku179
Created September 11, 2016 07:37
Show Gist options
  • Save riku179/c29936529158c3419911db0f1229e48a to your computer and use it in GitHub Desktop.
Save riku179/c29936529158c3419911db0f1229e48a to your computer and use it in GitHub Desktop.
service file for celery
# See
# http://docs.celeryproject.org/en/latest/tutorials/daemonizing.html#available-options
CELERY_APP="App name"
CELERYD_NODES="worker"
CELERYD_OPTS=""
CELERY_BIN="/usr/bin/celery"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
CELERYD_LOG_FILE="/var/log/celery/%n.log"
CELERYD_LOG_LEVEL="INFO"
[Unit]
Description=Celery Service
After=network.target
[Service]
Type=simple
User=celery
Group=celery
EnvironmentFile=-/etc/celery.conf
WorkingDirectory=/path/to/project
ExecStart=/usr/bin/celery -A \
$CELERY_APP $CELERYD_NODES --logfile=${CELERYD_LOG_FILE} \
--pidfile=${CELERYD_PID_FILE} $CELERYD_OPTS
ExecStop=/usr/bin/celery stopwait $CELERYD_NODES \
--pidfile=${CELERYD_PID_FILE}
ExecReload=/usr/bin/celery restart $CELERYD_NODES -A \
$CELERY_APP --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} \
--loglevel="${CELERYD_LOG_LEVEL}" $CELERYD_OPTS
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment