diff --git a/systemd/doorUpdater.service b/systemd/doorUpdater.service new file mode 100644 index 0000000..4287ec3 --- /dev/null +++ b/systemd/doorUpdater.service @@ -0,0 +1,9 @@ +[Unit] +Description=Update HID door controls +OnFailure=status-email-admin@%n.service + +[Service] +User=adam +Type=oneshot +WorkingDirectory=/home/adam/hidDoorWriter/ +ExecStart=/home/adam/hidDoorWriter/doorUpdater.py diff --git a/systemd/doorUpdater.timer b/systemd/doorUpdater.timer new file mode 100644 index 0000000..6575595 --- /dev/null +++ b/systemd/doorUpdater.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Hourly HID door control update + +[Timer] +OnCalendar=*:0/15 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/systemd/status-email-admin@.service b/systemd/status-email-admin@.service new file mode 100644 index 0000000..f50778f --- /dev/null +++ b/systemd/status-email-admin@.service @@ -0,0 +1,8 @@ +[Unit] +Description=status email for %i to sysadmin addresses + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/systemd-email "cms-errors@adamgoldsmith.name, steve@stevegoldsmith.com" %i +User=nobody +Group=systemd-journal \ No newline at end of file diff --git a/systemd/systemd-email b/systemd/systemd-email new file mode 100755 index 0000000..610daa4 --- /dev/null +++ b/systemd/systemd-email @@ -0,0 +1,11 @@ +#!/bin/bash + +/usr/sbin/sendmail -t < +Subject: $2 failed on $(hostname) +Content-Transfer-Encoding: 8bit +Content-Type: text/plain; charset=UTF-8 + +$(systemctl status --full "$2") +ERRMAIL