Commit 97eefd7b authored by Jonathan Michalon's avatar Jonathan Michalon

Provide a systemd templated unit

With systemd it's easy to manage several instances of picomon (via templated
units) so this should be quite usefull.
Also we switch to /etc/picomon for config (instead of %prefix%/etc/picomon)
as /usr/local/etc don't seem to exist for real and that way it's not abnormal
to ship the unit in /etc too. Also it's easier to manage the config at only
one place (think about etckeeper etc.).
parent 8bf86754
......@@ -101,11 +101,13 @@ A small watchdog is distributed which will send an email in case the main daemon
process exits (OOM, bug, etc.) to the same addresses than those used for check
status notifications. You may tune the subject with the config option `emails.watchdog_subject`.
For now, no sysv initscript / systemd unit / whatever for such a small daemon exists.
One simple way to run it is to use something like the following in `/etc/rc.local`
You have to run one picomon instance per config file.
A templated systemd unit is provided. For any configuration file you write you should be able to manage
the corresponding systemd service like usual (picomon@`name`.service).
Otherwise one simple way is something like the following in `/etc/rc.local`
(assuming a standard system-wide install with `setup.py install`):
for conf in /usr/local/etc/picomon/*.py; do sudo -u nobody picomon-watchdog -c $conf > /tmp/picomon-$(basename $conf .py).log 2>&1 & done
for conf in /etc/picomon/*.py; do sudo -u nobody picomon-watchdog -c $conf > /tmp/picomon-$(basename $conf .py).log 2>&1 & done
License
......
[Unit]
Description=Picomon Monitoring Daemon for %i
After=network.target
[Service]
ExecStart=/usr/local/bin/picomon-watchdog -c /etc/picomon/%i.py
#ExecReload=/bin/kill -HUP $MAINPID
User=nobody
Group=nogroup
[Install]
WantedBy=multi-user.target
......@@ -10,5 +10,6 @@ setup(name='Picomon',
url='http://gitlab.netlib.re/arn/picomon/',
packages=['picomon', 'picomon.subprocess_compat'],
scripts=['bin/picomon', 'bin/picomon-watchdog'],
data_files=[('etc/picomon/', ['config-sample.py'])],
data_files=[('/etc/picomon/', ['config-sample.py']),
('/etc/systemd/system', ['picomon@.service'])],
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment