Add the noshutdown keyword to special case the shutdown.

This commit is contained in:
Roy Marples 2009-04-27 12:04:33 +00:00
parent 338c93733d
commit 94b3057571
3 changed files with 12 additions and 5 deletions

View File

@ -13,8 +13,8 @@ depend()
need localmount need localmount
after bootmisc after bootmisc
provide net provide net
# We don't want to stop network unless we really have to # We don't want to stop the network at shutdown
keyword nostop keyword noshutdown
keyword nojail noprefix novserver keyword nojail noprefix novserver
} }

View File

@ -139,6 +139,12 @@ When in a jail, exclude this service from any dependencies. The service can
still be run directly. still be run directly.
.It Dv noopenvz .It Dv noopenvz
Same as nojail, but for OpenVZ systems. 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 .It Dv nostop
Don't stop this service when changing runlevels, even if not present. Don't stop this service when changing runlevels, even if not present.
This includes shutting the system down. This includes shutting the system down.

View File

@ -573,7 +573,7 @@ runlevel_config(const char *service, const char *level)
} }
static void static void
do_stop_services(const char *newlevel, bool parallel) do_stop_services(const char *newlevel, bool parallel, bool going_down)
{ {
pid_t pid; pid_t pid;
RC_STRING *service, *svc1, *svc2; RC_STRING *service, *svc1, *svc2;
@ -602,7 +602,8 @@ do_stop_services(const char *newlevel, bool parallel)
continue; continue;
} }
kwords = rc_deptree_depend(deptree, service->value, "keyword"); 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; nstop = true;
else else
nstop = false; nstop = false;
@ -1063,7 +1064,7 @@ main(int argc, char **argv)
/* Now stop the services that shouldn't be running */ /* Now stop the services that shouldn't be running */
if (stop_services) if (stop_services)
do_stop_services(newlevel, parallel); do_stop_services(newlevel, parallel, going_down);
/* Wait for our services to finish */ /* Wait for our services to finish */
wait_for_services(); wait_for_services();