Skip to content

Commit

Permalink
Add a consumer systemd service file
Browse files Browse the repository at this point in the history
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
  • Loading branch information
abompard authored and mergify[bot] committed Jan 30, 2019
1 parent 0e163d5 commit 9f03a3d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/fedora-messaging.rst
Expand Up @@ -95,6 +95,26 @@ configuration file and no options on the command line.
in *all* ``bindings`` entries in the configuration file.


Systemd service
===============

The ``consume`` subcommand can be started as a system service, and Fedora
Messaging provides a dynamic systemd service file.

First, create a valid Fedora Messaging configuration file in
``/etc/fedora-messaging/foo.toml``, with the ``callback`` parameter pointing to
your consuming function or class. Remember that you can use the
``consumer_config`` section for your own configuration.

Enable and start the service in systemd with the following commands::

systemctl enable fm-consumer@foo.service
systemctl start fm-consumer@foo.service

The service name after the ``@`` and before the ``.service`` must match your
filename in ``/etc/fedora-messaging`` (without the ``.toml`` suffix).


Help
====

Expand Down
11 changes: 11 additions & 0 deletions fm-consumer@.service
@@ -0,0 +1,11 @@
[Unit]
Description=Fedora Messaging consumer
Documentation=http://fedora-messaging.readthedocs.io/

[Service]
Type=simple
ExecStart=fedora-messaging --conf /etc/fedora-messaging/%i.toml consume
Restart=on-failure

[Install]
WantedBy=multi-user.target

0 comments on commit 9f03a3d

Please sign in to comment.