From eaa32c75c9bba7af0ec842d82f56a6862bbc83db Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sun, 26 Apr 2009 21:16:05 +0000 Subject: Add the nostop keyword so that we don't stop the network init script by default. --- init.d/network.in | 2 ++ man/runscript.8 | 7 +++++-- src/rc/rc.c | 12 ++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/init.d/network.in b/init.d/network.in index fbfd3b22..0c1e3616 100644 --- a/init.d/network.in +++ b/init.d/network.in @@ -13,6 +13,8 @@ depend() need localmount after bootmisc provide net + # We don't want to stop network unless we really have to + keyword nostop keyword nojail noprefix novserver } diff --git a/man/runscript.8 b/man/runscript.8 index c6157e89..fa8a8331 100644 --- a/man/runscript.8 +++ b/man/runscript.8 @@ -1,4 +1,4 @@ -.\" Copyright 2007-2008 Roy Marples +.\" Copyright 2007-2009 Roy Marples .\" All rights reserved .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd September 19, 2008 +.Dd April 26, 2009 .Dt RUNSCRIPT 8 SMM .Os OpenRC .Sh NAME @@ -139,6 +139,9 @@ 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 nostop +Don't stop this service when changing runlevels, even if not present. +This includes shutting the system down. .It Dv notimeout Do not time out waiting for that service. .It Dv nouml diff --git a/src/rc/rc.c b/src/rc/rc.c index 0336264c..0a4fba11 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -577,10 +577,10 @@ do_stop_services(const char *newlevel, bool parallel) { pid_t pid; RC_STRING *service, *svc1, *svc2; - RC_STRINGLIST *deporder, *tmplist; + RC_STRINGLIST *deporder, *tmplist, *kwords; RC_SERVICE state; RC_STRINGLIST *nostop; - bool crashed; + bool crashed, nstop; if (!types_n) { types_n = rc_stringlist_new(); @@ -601,6 +601,14 @@ do_stop_services(const char *newlevel, bool parallel) rc_service_mark(service->value, RC_SERVICE_FAILED); continue; } + kwords = rc_deptree_depend(deptree, service->value, "keyword"); + if (rc_stringlist_find(kwords, "nostop")) + nstop = true; + else + nstop = false; + rc_stringlist_free(kwords); + if (nstop) + continue; /* If the service has crashed, skip futher checks and just stop it */ -- cgit v1.2.3