aboutsummaryrefslogtreecommitdiff
path: root/src/runscript.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runscript.c')
-rw-r--r--src/runscript.c19
1 files changed, 6 insertions, 13 deletions
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");