Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example files for using with systemd #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ For a complete listing of the command-line options available see:

$ celery events --help

If you would like to use ``systemd`` to run the process, there are example
configuration files available under the ``extra/systemd/`` folder. After placing
the ``celerycam.conf`` under ``/etc/sysconfig/``, and ``celerycam.service`` under
``/etc/systemd/system/``, you will be able to use the ``systemctl`` command to
control the daemon. For example:

.. code-block:: console

$ systemctl start celerycam

.. code-block:: console

$ systemctl stop celerycam


Configuration
=============

Expand Down Expand Up @@ -147,4 +162,3 @@ In your Celery configuration simply set them to override the defaults, e.g.::
.. |pyimp| image:: https://img.shields.io/pypi/implementation/django-celery-monitor.svg
:alt: Support Python implementations.
:target: http://pypi.python.org/pypi/django_celery_monitor/

13 changes: 13 additions & 0 deletions extra/systemd/celerycam.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Absolute or relative path to the 'celery' command:
CELERY_BIN="/usr/bin/celery"
CELERY_APP="proj"

# Where to chdir at start.
CELERYCAM_CHDIR="/opt/celery"

# Extra arguments to celerycam
CELERYCAM_OPTS="--camera django_celery_monitor.camera.Camera --frequency=2.0"

CELERYCAM_LOG_FILE="/var/log/celery/celerycam.log"
CELERYCAM_PID_FILE="/var/run/celery/celery_cam.pid"
CELERYCAM_LOG_LEVEL="INFO"
20 changes: 20 additions & 0 deletions extra/systemd/celerycam.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=Celery Camera Service
After=network.target

[Service]
Type=simple
User=celery
Group=celery
EnvironmentFile=/etc/sysconfig/celerycam.conf
WorkingDirectory=/opt/celery
ExecStart=/bin/sh -c '${CELERY_BIN} events -A ${CELERY_APP} \
--workdir=${CELERYCAM_CHDIR} \
--pidfile=${CELERYCAM_PID_FILE} \
--logfile=${CELERYCAM_LOG_FILE} \
--loglevel=${CELERYCAM_LOG_LEVEL} \
${CELERYCAM_OPTS}'
ExecStop=/bin/systemctl kill celerycam.service

[Install]
WantedBy=multi-user.target