diff options
author | Michel Stam <m.stam@fugro.nl> | 2014-10-02 13:56:20 +0200 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2014-10-02 19:18:52 +0200 |
commit | 98975d54d405c45edf7bab2205d6ffb75ed90438 (patch) | |
tree | 5f2511e7d08da7ea4205238ca56d03647507619d | |
parent | 396a82c551ab02871ec0e6f399941c9379258bdc (diff) | |
download | unitd-98975d54d405c45edf7bab2205d6ffb75ed90438.tar unitd-98975d54d405c45edf7bab2205d6ffb75ed90438.zip |
Kill processes on shutdown
Procd as it currently is does not kill the running processes during shutdown.
As this might cause undesired behaviour, this should be implemented.
Implementation was taken from busybox 1.19.4
Signed-off-by: Michel Stam <m.stam@fugro.nl>
-rw-r--r-- | state.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -15,6 +15,8 @@ #include <sys/reboot.h> #include <stdlib.h> #include <unistd.h> +#include <sys/types.h> +#include <signal.h> #include "procd.h" #include "syslog.h" @@ -75,6 +77,14 @@ static void state_enter(void) break; case STATE_HALT: + LOG("- SIGTERM processes -\n"); + kill(-1, SIGTERM); + sync(); + sleep(1); + LOG("- SIGKILL processes -\n"); + kill(-1, SIGKILL); + sync(); + sleep(1); LOG("- reboot -\n"); reboot(reboot_event); break; |