aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Gruver <JesusFreke@JesusFreke.com>2009-01-13 20:43:30 -0600
committerJean-Baptiste Queru <jbq@google.com>2009-08-27 07:58:38 -0700
commitdc816d5dcd87a3578e47eade55db80b99b802c62 (patch)
tree548b5ba82c91baea09704f69f2b6ce0fdd5f664c
parente7cb137f32fbc7caf97b80fac152b4bd3ac242cd (diff)
downloadsystem_core-dc816d5dcd87a3578e47eade55db80b99b802c62.tar.gz
system_core-dc816d5dcd87a3578e47eade55db80b99b802c62.tar.bz2
system_core-dc816d5dcd87a3578e47eade55db80b99b802c62.zip
Allow an onrestart command to stop the current service
For example, service recovery /sbin/recovery onrestart start loadkeys onrestart class_start con onrestart stop recovery Previously, if you had a service like the above, the "onrestart stop recovery" clause would not have any effect, because the restart flag would be re-set after the stop command had executed. This is similar to a service with the "oneshot" keyword, with the critical difference being that it executes the other onrestart commands when the service dies.
-rwxr-xr-x[-rw-r--r--]init/init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/init/init.c b/init/init.c
index 896aff89..adc4c9f2 100644..100755
--- a/init/init.c
+++ b/init/init.c
@@ -389,12 +389,13 @@ static int wait_for_one_process(int block)
}
}
+ svc->flags |= SVC_RESTARTING;
+
/* Execute all onrestart commands for this service. */
list_for_each(node, &svc->onrestart.commands) {
cmd = node_to_item(node, struct command, clist);
cmd->func(cmd->nargs, cmd->args);
}
- svc->flags |= SVC_RESTARTING;
notify_service_state(svc->name, "restarting");
return 0;
}