From 1fba609bb30940d3227cd82dfb18b9a0635350b2 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 9 Apr 2019 13:52:17 +0200 Subject: systemd timer and service new --- .gitignore | 2 ++ Makefile | 6 ++++-- shutdownasap.service.in | 5 +++++ shutdownasap.timer.in | 8 ++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 shutdownasap.service.in create mode 100644 shutdownasap.timer.in diff --git a/.gitignore b/.gitignore index 0418a11..ff996f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ shutdownasap shutdownasap.1 shutdownasap.conf +shutdownasap.service +shutdownasap.timer diff --git a/Makefile b/Makefile index dd6d29d..16b49e0 100644 --- a/Makefile +++ b/Makefile @@ -23,20 +23,22 @@ DESTDIR = ETCDIR = /etc BINDIR = /usr/bin MANDIR = /usr/share/man +SYSTEMDDIR = /usr/lib/systemd/system VERSION = 0.7 -all: shutdownasap shutdownasap.conf shutdownasap.1 +all: shutdownasap shutdownasap.conf shutdownasap.1 shutdownasap.service shutdownasap.timer %: %.in sed "s/#VERSION#/$(VERSION)/; s@#BINDIR#@$(BINDIR)@; s@#ETCDIR#@$(ETCDIR)@" $< > $@ -.PHONY: install dist clean +.PHONY: install install-systemd dist clean install: all install -D -m0755 -t $(DESTDIR)$(BINDIR) shutdownasap install -D -m0644 -t $(DESTDIR)$(MANDIR)/man1 shutdownasap.1 install -D -m0644 -t $(DESTDIR)$(ETCDIR) shutdownasap.conf + install -D -m0644 -t $(DESTDIR)$(SYSTEMDDIR) shutdownasap.service shutdownasap.timer clean: rm -f shutdownasap shutdownasap.1 shutdownasap.conf diff --git a/shutdownasap.service.in b/shutdownasap.service.in new file mode 100644 index 0000000..0c3f6c8 --- /dev/null +++ b/shutdownasap.service.in @@ -0,0 +1,5 @@ +[Unit] +Description=shut down asap + +[Service] +ExecStart=#BINDIR#/shutdownasap diff --git a/shutdownasap.timer.in b/shutdownasap.timer.in new file mode 100644 index 0000000..7f42597 --- /dev/null +++ b/shutdownasap.timer.in @@ -0,0 +1,8 @@ +[Unit] +Description=shut down asap 1h after the system came up + +[Timer] +OnStartupSec=1h + +[Install] +WantedBy=timers.target -- cgit v1.2.3-70-g09d2