daemon: basic systemd integration
Notify systemd when NFD is ready/reloading/terminating
Change-Id: I833b48fbcaf6ecc2c4bb8a1da67d4eb9a050c116
Refs: #2815
diff --git a/contrib/systemd/README.md b/contrib/systemd/README.md
index 7c722ab..d129b5e 100644
--- a/contrib/systemd/README.md
+++ b/contrib/systemd/README.md
@@ -1,8 +1,8 @@
Starting NFD on Linux with systemd
==================================
-Newer versions of Ubuntu (starting with 15.04) and some other Linux distributions, including Debian
-use systemd to start system daemons, monitor their health, and restart them when they die.
+Modern versions of Ubuntu (starting with 15.04) and some other Linux distributions, including Debian
+and Fedora, use systemd to start system daemons, monitor their health, and restart them when they die.
Initial setup
-------------
@@ -127,4 +127,4 @@
To permanently stop the `nfd` daemon and disable it from being automatically started on reboot,
disable the service:
- sudo systemctl disable nfd
\ No newline at end of file
+ sudo systemctl disable nfd
diff --git a/contrib/systemd/nfd.service b/contrib/systemd/nfd.service
index 063e4a7..57661fd 100644
--- a/contrib/systemd/nfd.service
+++ b/contrib/systemd/nfd.service
@@ -30,9 +30,10 @@
After=network-online.target
[Service]
+Type=notify
Environment=HOME=/usr/local/var/lib/ndn/nfd
ExecStart=/usr/local/bin/nfd --config /usr/local/etc/ndn/nfd.conf
-ExecStartPost=/bin/sh -ec 'sleep 2; if [ -f /usr/local/etc/ndn/nfd-init.sh ]; then . /usr/local/etc/ndn/nfd-init.sh; fi'
+ExecStartPost=/bin/sh -ec 'if [ -f /usr/local/etc/ndn/nfd-init.sh ]; then . /usr/local/etc/ndn/nfd-init.sh; fi'
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartPreventExitStatus=2 4