From: Francois Fleuret Date: Sat, 14 Nov 2015 14:24:32 +0000 (+0100) Subject: Added a restart on failure + made systemd install the default. X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=d0e216af888174d64c79899e6a9dffc8716ed0b8;p=breezed.git Added a restart on failure + made systemd install the default. --- diff --git a/Makefile b/Makefile index c635dcd..1653694 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ BINARY_PATH = $(DESTDIR)/usr/bin MAN_PATH = $(DESTDIR)/usr/share/man/man1 +SYSTEMD_PATH = $(DESTDIR)/etc/systemd/system PM_SLEEPD = $(DESTDIR)/usr/lib/pm-utils/sleep.d CFLAGS = -Wall -D_GNU_SOURCE -ansi -pedantic $(OPTIMIZE_FLAG) @@ -31,32 +32,34 @@ breezed: breezed.c install: breezed $(DESTDIR)/etc/breezed.conf install -m 755 breezed $(BINARY_PATH) - install -m 755 breezed.sh $(DESTDIR)/etc/init.d/ install -m 644 breezed.1 $(MAN_PATH) gzip $(MAN_PATH)/breezed.1 - install -m 755 breezed-pm-utils.sh $(PM_SLEEPD)/50breezed - update-rc.d breezed.sh defaults - $(DESTDIR)/etc/init.d/breezed.sh start + install -m 644 breezed.service $(SYSTEMD_PATH) + systemctl enable breezed + systemctl start breezed uninstall: - $(DESTDIR)/etc/init.d/breezed.sh stop - update-rc.d -f breezed.sh remove - rm $(PM_SLEEPD)/50breezed + systemctl stop breezed + systemctl disable breezed + rm $(SYSTEMD_PATH)/breezed.service rm $(MAN_PATH)/breezed.1.gz - rm $(DESTDIR)/etc/init.d/breezed.sh rm $(BINARY_PATH)/breezed -install-systemd: breezed $(DESTDIR)/etc/breezed.conf +install-sysv: breezed $(DESTDIR)/etc/breezed.conf install -m 755 breezed $(BINARY_PATH) + install -m 755 breezed.sh $(DESTDIR)/etc/init.d/ install -m 644 breezed.1 $(MAN_PATH) gzip $(MAN_PATH)/breezed.1 - install -m 644 breezed.service /etc/systemd/system/ - systemctl start breezed + install -m 755 breezed-pm-utils.sh $(PM_SLEEPD)/50breezed + update-rc.d breezed.sh defaults + $(DESTDIR)/etc/init.d/breezed.sh start -uninstall-systemd: - systemctl stop breezed - rm /etc/systemd/system/breezed.service +uninstall-sysv: + $(DESTDIR)/etc/init.d/breezed.sh stop + update-rc.d -f breezed.sh remove + rm $(PM_SLEEPD)/50breezed rm $(MAN_PATH)/breezed.1.gz + rm $(DESTDIR)/etc/init.d/breezed.sh rm $(BINARY_PATH)/breezed clean: diff --git a/README.txt b/README.txt index 50e84cb..839affa 100644 --- a/README.txt +++ b/README.txt @@ -29,8 +29,8 @@ make uninstall - Use respectively install-systemd and uninstall-systemd to install - it for systemd. + Use respectively install-sysv and uninstall-sysv to install it + through /etc/init.d. See the man page for details about the algorithm, arguments and configuration file. diff --git a/breezed.service b/breezed.service index 367a3e9..81e6b94 100644 --- a/breezed.service +++ b/breezed.service @@ -1,7 +1,13 @@ [Unit] Description=Fan control daemon +After=syslog.target [Service] Type=simple ExecStart=/usr/bin/breezed -PIDFile=/var/run/breezed.pid +StandardError=syslog+console +Restart=on-failure +RestartSec=3 + +[Install] +WantedBy=multi-user.target