diff options
-rw-r--r-- | init.d/network.in | 4 | ||||
-rw-r--r-- | man/runscript.8 | 6 | ||||
-rw-r--r-- | src/rc/rc.c | 7 |
3 files changed, 12 insertions, 5 deletions
diff --git a/init.d/network.in b/init.d/network.in index 379b9a39..fb9668cf 100644 --- a/init.d/network.in +++ b/init.d/network.in @@ -13,8 +13,8 @@ depend() need localmount after bootmisc provide net - # We don't want to stop network unless we really have to - keyword nostop + # We don't want to stop the network at shutdown + keyword noshutdown keyword nojail noprefix novserver } diff --git a/man/runscript.8 b/man/runscript.8 index fa8a8331..b89e3a0a 100644 --- a/man/runscript.8 +++ b/man/runscript.8 @@ -139,6 +139,12 @@ When in a jail, exclude this service from any dependencies. The service can still be run directly. .It Dv noopenvz Same as nojail, but for OpenVZ systems. +.It Dv noshutdown +Don't stop this service when shutting the system down. +This normally quite safe as remaining daemons will be sent a SIGTERM just +before final shutdown. +Network related services such as the network and dhcpcd init scripts normally +have this keyword. .It Dv nostop Don't stop this service when changing runlevels, even if not present. This includes shutting the system down. diff --git a/src/rc/rc.c b/src/rc/rc.c index 0be79011..9b4a7e5c 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -573,7 +573,7 @@ runlevel_config(const char *service, const char *level) } static void -do_stop_services(const char *newlevel, bool parallel) +do_stop_services(const char *newlevel, bool parallel, bool going_down) { pid_t pid; RC_STRING *service, *svc1, *svc2; @@ -602,7 +602,8 @@ do_stop_services(const char *newlevel, bool parallel) continue; } kwords = rc_deptree_depend(deptree, service->value, "keyword"); - if (rc_stringlist_find(kwords, "nostop")) + if (rc_stringlist_find(kwords, "nostop") || + (going_down && rc_stringlist_find(kwords, "noshutdown"))) nstop = true; else nstop = false; @@ -1063,7 +1064,7 @@ main(int argc, char **argv) /* Now stop the services that shouldn't be running */ if (stop_services) - do_stop_services(newlevel, parallel); + do_stop_services(newlevel, parallel, going_down); /* Wait for our services to finish */ wait_for_services(); |