diff options
author | Christian Hesse <mail@eworm.de> | 2017-01-06 10:04:42 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2017-01-06 10:04:42 +0100 |
commit | b759e9df4b2da57f2fc6dd99d150a375aa6e9081 (patch) | |
tree | 61458b432a2f7e5cdfa37a13407121e83e26a64a | |
parent | a29c91adffd2be2529646674e9ac9d13d6b8e3da (diff) | |
download | netlink-notify-b759e9df4b2da57f2fc6dd99d150a375aa6e9081.tar.gz netlink-notify-b759e9df4b2da57f2fc6dd99d150a375aa6e9081.tar.zst |
notify systemd on stop
-rw-r--r-- | netlink-notify.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/netlink-notify.c b/netlink-notify.c index 5d96afa..4526ebe 100644 --- a/netlink-notify.c +++ b/netlink-notify.c @@ -517,6 +517,11 @@ int main (int argc, char **argv) { if (verbose > 0) printf("%s: Exiting...\n", program); + /* report stopping to systemd */ +#ifdef HAVE_SYSTEMD + sd_notify(0, "STOPPING=1\nSTATUS=Stopping..."); +#endif + for(; maxinterface > 0; maxinterface--) { if (verbose > 0) printf("%s: Freeing interface %d: %s\n", program, @@ -541,5 +546,9 @@ out30: fprintf(stderr, "%s: Failed to close socket.\n", program); out40: +#ifdef HAVE_SYSTEMD + sd_notify(0, "STATUS=Stopped. Bye!"); +#endif + return rc; } |