summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2017-01-06 10:03:05 +0100
committerGravatar Christian Hesse <mail@eworm.de>2017-01-06 10:03:05 +0100
commita9ccf14e418a5032c4efff78ce5c8269382a30dd (patch)
tree94b2905216dbdeaff817a0273da024ddeea00790
parent9911d3106452fb5733c4c7c00e2873427b8ca036 (diff)
downloadmpd-notification-a9ccf14e418a5032c4efff78ce5c8269382a30dd.tar.gz
mpd-notification-a9ccf14e418a5032c4efff78ce5c8269382a30dd.tar.zst
notify systemd on stop
-rw-r--r--mpd-notification.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mpd-notification.c b/mpd-notification.c
index 4e78e2e..d352c5f 100644
--- a/mpd-notification.c
+++ b/mpd-notification.c
@@ -511,6 +511,11 @@ nonotification:
if (verbose > 0)
printf("%s: Exiting...\n", program);
+ /* report stopping to systemd */
+#ifdef HAVE_SYSTEMD
+ sd_notify(0, "STOPPING=1\nSTATUS=Stopping...");
+#endif
+
rc = EXIT_SUCCESS;
out10:
@@ -531,5 +536,9 @@ out40:
if (ini != NULL)
iniparser_freedict(ini);
+#ifdef HAVE_SYSTEMD
+ sd_notify(0, "STATUS=Stopped. Bye!");
+#endif
+
return rc;
}