system/corennnnn
Revision | d939ad5b08441c276a2da611b6d0651513d59412 (tree) |
---|---|
Zeit | 2010-04-14 19:12:28 |
Autor | Ben Gruver <JesusFreke@Jesu...> |
Commiter | Chih-Wei Huang |
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.
@@ -389,12 +389,13 @@ static int wait_for_one_process(int block) | ||
389 | 389 | } |
390 | 390 | } |
391 | 391 | |
392 | + svc->flags |= SVC_RESTARTING; | |
393 | + | |
392 | 394 | /* Execute all onrestart commands for this service. */ |
393 | 395 | list_for_each(node, &svc->onrestart.commands) { |
394 | 396 | cmd = node_to_item(node, struct command, clist); |
395 | 397 | cmd->func(cmd->nargs, cmd->args); |
396 | 398 | } |
397 | - svc->flags |= SVC_RESTARTING; | |
398 | 399 | notify_service_state(svc->name, "restarting"); |
399 | 400 | return 0; |
400 | 401 | } |