From 2ef9c5c5208d6d911c3826d94ac72c2bd9813c2c Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 19 Nov 2007 13:46:09 +0000 Subject: Only start plugins once we have made an exclusive file --- src/runscript.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/runscript.c b/src/runscript.c index 3683080e..5c214c79 100644 --- a/src/runscript.c +++ b/src/runscript.c @@ -587,8 +587,6 @@ static void svc_start (bool deps) const char *svcl[] = { applet, NULL }; rc_service_state_t state; - hook_out = RC_HOOK_SERVICE_START_OUT; - rc_plugin_run (RC_HOOK_SERVICE_START_IN, applet); state = rc_service_state (service); if (rc_env_bool ("IN_HOTPLUG") || in_background) { @@ -600,10 +598,6 @@ static void svc_start (bool deps) if (state & RC_SERVICE_STARTED) { ewarn ("WARNING: %s has already been started", applet); - if (hook_out) { - hook_out = 0; - rc_plugin_run (hook_out) - } return; } else if (state & RC_SERVICE_STARTING) ewarnx ("WARNING: %s is already starting", applet); @@ -617,6 +611,9 @@ static void svc_start (bool deps) make_exclusive (service); + hook_out = RC_HOOK_SERVICE_START_OUT; + rc_plugin_run (RC_HOOK_SERVICE_START_IN, applet); + if (rc_env_bool ("RC_DEPEND_STRICT")) depoptions |= RC_DEP_STRICT; @@ -803,9 +800,6 @@ static void svc_stop (bool deps) rc_service_state_t state = rc_service_state (service); - hook_out = RC_HOOK_SERVICE_STOP_OUT; - rc_plugin_run (RC_HOOK_SERVICE_STOP_IN, applet); - if (rc_runlevel_stopping () && state & RC_SERVICE_FAILED) exit (EXIT_FAILURE); @@ -817,10 +811,6 @@ static void svc_stop (bool deps) if (state & RC_SERVICE_STOPPED) { ewarn ("WARNING: %s is already stopped", applet); - if (hook_out) { - hook_out = 0; - rc_plugin_run (hook_out) - } return; } else if (state & RC_SERVICE_STOPPING) ewarnx ("WARNING: %s is already stopping", applet); @@ -830,6 +820,9 @@ static void svc_stop (bool deps) make_exclusive (service); + hook_out = RC_HOOK_SERVICE_STOP_OUT; + rc_plugin_run (RC_HOOK_SERVICE_STOP_IN, applet); + if (! rc_runlevel_stopping () && rc_service_in_runlevel (service, RC_LEVEL_BOOT)) ewarn ("WARNING: you are stopping a boot service"); -- cgit v1.2.3