summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile3
-rw-r--r--digest-mailer.service.in6
-rw-r--r--digest-mailer.timer11
4 files changed, 20 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 8450088..4a6efec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@ digest-mailer
man.commons
*.common
*.conf
+*.service
*.1
diff --git a/Makefile b/Makefile
index dca30a7..0079eb0 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ MANDIR = /usr/share/man
VERSION = 0.3
-all: man.commons digest-mailer digest-mailer.1 digest-mailer.conf
+all: man.commons digest-mailer digest-mailer.1 digest-mailer.conf digest-mailer.service
%: %.in
sed " \
@@ -52,6 +52,7 @@ install: all
install -D -m0755 digest-mailer $(DESTDIR)$(BINDIR)/digest-mailer
install -D -m0644 digest-mailer.1 $(DESTDIR)$(MANDIR)/man1/digest-mailer.1
install -D -m0644 digest-mailer.conf $(DESTDIR)$(ETCDIR)/digest-mailer.conf
+ install -D -m0644 -t $(DESTDIR)$(LIBDIR)/systemd/system/ digest-mailer.service digest-mailer.timer
clean:
ls -A | \
diff --git a/digest-mailer.service.in b/digest-mailer.service.in
new file mode 100644
index 0000000..7c5d803
--- /dev/null
+++ b/digest-mailer.service.in
@@ -0,0 +1,6 @@
+[Unit]
+Description=send mail digest
+
+[Service]
+Type=oneshot
+ExecStart=#BINDIR#/digest-mailer -f
diff --git a/digest-mailer.timer b/digest-mailer.timer
new file mode 100644
index 0000000..d38d7de
--- /dev/null
+++ b/digest-mailer.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=repeatedly send mail digest
+
+[Timer]
+AccuracySec=1us
+RandomizedDelaySec=4min
+OnUnitInactiveSec=4min
+OnBootSec=4min
+
+[Install]
+WantedBy=timers.target