Add systemd config for running as a service
This commit is contained in:
parent
2b894d3cc9
commit
659459ddd3
9
systemd/doorUpdater.service
Normal file
9
systemd/doorUpdater.service
Normal file
@ -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
|
9
systemd/doorUpdater.timer
Normal file
9
systemd/doorUpdater.timer
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Hourly HID door control update
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=*:0/15
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
8
systemd/status-email-admin@.service
Normal file
8
systemd/status-email-admin@.service
Normal file
@ -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
|
11
systemd/systemd-email
Executable file
11
systemd/systemd-email
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
/usr/sbin/sendmail -t <<ERRMAIL
|
||||||
|
To: $1
|
||||||
|
From: systemd <root@$HOSTNAME>
|
||||||
|
Subject: $2 failed on $(hostname)
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
|
||||||
|
$(systemctl status --full "$2")
|
||||||
|
ERRMAIL
|
Reference in New Issue
Block a user