Commit 2f56ec42 authored by Patrick J Cherry's avatar Patrick J Cherry
Browse files

Merge branch 'stretch-monit-systemd-timer' into 'stretch'

Run symbiosis-monit from a systemd timer.

See merge request !48
parents 11a27d13 3b33240f
......@@ -3,7 +3,7 @@ Section: web
Priority: extra
Maintainer: James Carter <jcarter@bytemark.co.uk>
Uploaders: Patrick J Cherry <patrick@bytemark.co.uk>, Steve Kemp <steve@bytemark.co.uk>
Build-Depends: debhelper (>= 7.0.0), txt2man, gem2deb, ruby
Build-Depends: debhelper (>= 7.0.0), txt2man, gem2deb, ruby, dh-systemd
Standards-Version: 3.9.6
XS-Ruby-Versions: all
......
......@@ -14,7 +14,7 @@
#export DH_RUBY_GEMSPEC=gem.gemspec
%:
dh $@ --buildsystem=ruby --with ruby
dh $@ --buildsystem=ruby --with ruby,systemd
override_dh_auto_build-indep:
$(MAKE) all
......
sbin/symbiosis-monit usr/sbin/
sbin/* usr/sbin/
monit.d/* usr/share/symbiosis/monit/checks/
templates/* usr/share/symbiosis/monit/
lib/* usr/lib/ruby/vendor_ruby/
test.d/* etc/symbiosis/test.d/
system/* lib/systemd/system/
#!/bin/bash
set -e
args="--since=today"
[ -e "/var/tmp/symbiosis-monit.cursor" ] && args="--after-cursor=$(</var/tmp/symbiosis-monit.cursor)"
journalctl -b0 $args -o cat -u "symbiosis-monit.service" | mail -s "Symbiosis monitor detected service failure" root
[Unit]
Description=Notify by email about symbiosis-monit failure
[Service]
Type=simple
ExecStart=/usr/sbin/symbiosis-monit-failure-email
[Unit]
Description=Symbiosis monitor
OnFailure=symbiosis-monit-failure-email.service
[Service]
Type=simple
ExecStartPre=/bin/sh -c 'journalctl -o cat -n 0 -u %n --show-cursor | cut -f3 -d" " | sudo -u nobody tee /var/tmp/symbiosis-monit.cursor >/dev/null'
ExecStart=/usr/sbin/symbiosis-monit -t email /etc/symbiosis/monit.d
[Unit]
Description=Regularly execute symbiosis-monit.service
[Timer]
# run every 2 minutes
OnCalendar=*:0/2
[Install]
WantedBy=timers.target
Supports Markdown
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