Skip to content

Commit 46315ce

Browse files
Add example files for using with systemd
1 parent 1f890c9 commit 46315ce

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

README.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ For a complete listing of the command-line options available see:
9494
9595
$ celery events --help
9696
97+
If you would like to use ``systemd`` to run the process, there are example
98+
configuration files available under the ``extra/systemd/`` folder. After placing
99+
the ``celerycam.conf`` under ``/etc/``, and ``celerycam.service`` under
100+
``/etc/systemd/system/``, you will be able to use the ``systemctl`` command to
101+
control the daemon. For example:
102+
103+
.. code-block:: console
104+
105+
$ systemctl start celerycam
106+
107+
.. code-block:: console
108+
109+
$ systemctl stop celerycam
110+
111+
97112
Configuration
98113
=============
99114

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

extra/systemd/celerycam.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Absolute or relative path to the 'celery' command:
2+
CELERY_BIN="/usr/bin/celery"
3+
CELERY_APP="proj"
4+
5+
# Where to chdir at start.
6+
CELERYCAM_CHDIR="/opt/celery"
7+
8+
# Extra arguments to celerycam
9+
CELERYCAM_OPTS="--camera django_celery_monitor.camera.Camera --frequency=2.0"
10+
11+
CELERYCAM_LOG_FILE="/var/log/celery/celerycam.log"
12+
CELERYCAM_PID_FILE="/var/run/celery/celery_cam.pid"
13+
CELERYCAM_LOG_LEVEL="INFO"

extra/systemd/celerycam.service

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[Unit]
2+
Description=Celery Camera Service
3+
After=network.target
4+
5+
[Service]
6+
Type=simple
7+
User=celery
8+
Group=celery
9+
EnvironmentFile=/etc/sysconfig/celerycam
10+
WorkingDirectory=/opt/celery
11+
ExecStart=/bin/sh -c '${CELERY_BIN} events -A ${CELERY_APP} \
12+
--workdir=${CELERYCAM_CHDIR} \
13+
--pidfile=${CELERYCAM_PID_FILE} \
14+
--logfile=${CELERYCAM_LOG_FILE} \
15+
--loglevel=${CELERYCAM_LOG_LEVEL} \
16+
${CELERYCAM_OPTS}'
17+
ExecStop=/bin/systemctl kill celerycam.service
18+
19+
[Install]
20+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)