bandwidthd: Add systemd unit file and install it to run at startup.
authorNathaniel Roach <nroach44@gmail.com>
Sun, 11 Jan 2015 05:31:34 +0000 (13:31 +0800)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 11 Jan 2015 19:44:52 +0000 (20:44 +0100)
Signed-off-by: Nathaniel Roach <nroach44@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/bandwidthd/bandwidthd.mk
package/bandwidthd/bandwidthd.service [new file with mode: 0644]

index ca991f992395388cd4010fe8767e57d7a10af19a..2773490428d86a00c551ce2d59f656e3c50388f8 100644 (file)
@@ -31,4 +31,14 @@ else
 BANDWIDTHD_CONF_OPTS += --with-sqlite-storage=false
 endif
 
+define BANDWIDTHD_INSTALL_INIT_SYSTEMD
+       $(INSTALL) -D -m 644 package/bandwidthd/bandwidthd.service \
+               $(TARGET_DIR)/usr/lib/systemd/system/bandwidthd.service
+
+       mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+
+       ln -sf /usr/lib/systemd/system/bandwidthd.service \
+               $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/bandwidthd.service
+endef
+
 $(eval $(autotools-package))
diff --git a/package/bandwidthd/bandwidthd.service b/package/bandwidthd/bandwidthd.service
new file mode 100644 (file)
index 0000000..9c03d42
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Bandwidth usage monitor and reporter
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/bandwidthd
+PIDFile=/var/run/bandwidthd.pid
+
+[Install]
+WantedBy=multi-user.target