[Initng-svn] r3017 - in initng: plugins/daemon src

svn at initng.thinktux.net svn at initng.thinktux.net
Fri Feb 17 12:29:14 CET 2006


Author: jimmy
Date: Fri Feb 17 12:29:13 2006
New Revision: 3017

Modified:
   initng/plugins/daemon/initng_daemon.c
   initng/src/initng_handler.c
Log:
Let the service plugins tell if you can stop a starting service or not, dont check this default in initng_handler.c


Modified: initng/plugins/daemon/initng_daemon.c
==============================================================================
--- initng/plugins/daemon/initng_daemon.c	(original)
+++ initng/plugins/daemon/initng_daemon.c	Fri Feb 17 12:29:13 2006
@@ -307,6 +307,11 @@
 static int start_DAEMON(active_db_h * daemon_to_start)
 {
     D_("Starting daemon %s.\n", daemon_to_start->name);
+
+    /* Start all services we are depending service */
+    if(initng_depend_start_deps(daemon)!=TRUE)
+	return(FALSE);
+
     /* mark it WAITING_FOR_START_DEP and wait */
     if (!initng_common_mark_service(daemon_to_start, &DAEMON_START_MARKED))
     {
@@ -314,6 +319,8 @@
            daemon_to_start->name);
         return (FALSE);
     }
+    
+    /* return happily */
     return (TRUE);
 }
 

Modified: initng/src/initng_handler.c
==============================================================================
--- initng/src/initng_handler.c	(original)
+++ initng/src/initng_handler.c	Fri Feb 17 12:29:13 2006
@@ -111,13 +111,6 @@
 	return (FALSE);
     }
     
-    /* IF service is stopping, we can not currently start it */
-    if (IS_STOPPING(service_to_start))
-    {
-        D_("service %s is stopping, cant start it.\n", service_to_start->name);
-        return (TRUE);
-    }
-
     /* it might already be up */
     if (IS_UP(service_to_start))
     {
@@ -125,8 +118,8 @@
         return (TRUE);
     }
 
-    /* make sure state is in the states, that we can start */
-    if (!IS_DOWN(service_to_start))
+    /* it must be down or stopping to start it */
+    if (!(IS_DOWN(service_to_start) || IS_STOPPING(service_to_start)))
     {
         W_("Can't set a service with status %s, to start\n",
            service_to_start->current_state->state_name);
@@ -179,13 +172,6 @@
         return (TRUE);
     }
 
-    /* if starting, direct abort */
-    if (IS_STARTING(service_to_stop))
-    {
-        D_("Service %s is starting, can't stop it!\n", service_to_stop->name);
-        return (FALSE);
-    }
-
     /* check if its currently allredy down */
     if (IS_DOWN(service_to_stop))
     {
@@ -193,8 +179,8 @@
 	return (TRUE);
     }
     
-    /* make sure the service is up */
-    if (!IS_UP(service_to_stop))
+    /* must be up or starting, to stop */
+    if (!(IS_UP(service_to_stop) || IS_STARTING(service_to_stop)))
     {
         W_("Service %s is not up but %s, and cant be stopped.\n",
            service_to_stop->name, service_to_stop->current_state->state_name);


More information about the Initng-svn mailing list