Added a restart on failure + made systemd install the default.
authorFrancois Fleuret <francois@fleuret.org>
Sat, 14 Nov 2015 14:24:32 +0000 (15:24 +0100)
committerFrancois Fleuret <francois@fleuret.org>
Sat, 14 Nov 2015 14:24:32 +0000 (15:24 +0100)
Makefile
README.txt
breezed.service

index c635dcd..1653694 100644 (file)
--- 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:
index 50e84cb..839affa 100644 (file)
@@ -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.
index 367a3e9..81e6b94 100644 (file)
@@ -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