Skip to content

Commit 7434545

Browse files
mfonvilleauvipy
authored andcommitted
Update daemonizing.rst
Improved systemd documentation for auto-start of the service, and mention the possibility to depend on RabbitMQ service. Also add Restart=always for Celery Beat example
1 parent f50cf7d commit 7434545

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/userguide/daemonizing.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,12 @@ This is an example systemd file:
415415
Once you've put that file in :file:`/etc/systemd/system`, you should run
416416
:command:`systemctl daemon-reload` in order that Systemd acknowledges that file.
417417
You should also run that command each time you modify it.
418+
Use :command:`systemctl enable celery.service` if you want the celery service to
419+
automatically start when (re)booting the system.
420+
421+
Optionally you can specify extra dependencies for the celery service: e.g. if you use
422+
RabbitMQ as a broker, you could specify ``rabbitmq-server.service`` in both ``After=`` and ``Requires=``
423+
in the ``[Unit]`` `systemd section <https://www.freedesktop.org/software/systemd/man/systemd.unit.html#%5BUnit%5D%20Section%20Options>`_.
418424

419425
To configure user, group, :command:`chdir` change settings:
420426
``User``, ``Group``, and ``WorkingDirectory`` defined in
@@ -496,10 +502,16 @@ This is an example systemd file for Celery Beat:
496502
ExecStart=/bin/sh -c '${CELERY_BIN} -A ${CELERY_APP} beat \
497503
--pidfile=${CELERYBEAT_PID_FILE} \
498504
--logfile=${CELERYBEAT_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL}'
505+
Restart=always
499506
500507
[Install]
501508
WantedBy=multi-user.target
502509
510+
Once you've put that file in :file:`/etc/systemd/system`, you should run
511+
:command:`systemctl daemon-reload` in order that Systemd acknowledges that file.
512+
You should also run that command each time you modify it.
513+
Use :command:`systemctl enable celerybeat.service` if you want the celery beat
514+
service to automatically start when (re)booting the system.
503515

504516
Running the worker with superuser privileges (root)
505517
======================================================================

0 commit comments

Comments
 (0)