From a9ccf14e418a5032c4efff78ce5c8269382a30dd Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 6 Jan 2017 10:03:05 +0100 Subject: notify systemd on stop --- mpd-notification.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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; } -- cgit v1.2.3-70-g09d2