[Initng-svn] r2971 - initng/plugins/also

svn at initng.thinktux.net svn at initng.thinktux.net
Thu Feb 9 14:55:12 CET 2006


Author: jimmy
Date: Thu Feb  9 14:55:11 2006
New Revision: 2971

Modified:
   initng/plugins/also/initng_also.c
Log:
Fix initng_also.c plugin.


Modified: initng/plugins/also/initng_also.c
==============================================================================
--- initng/plugins/also/initng_also.c	(original)
+++ initng/plugins/also/initng_also.c	Thu Feb  9 14:55:11 2006
@@ -52,7 +52,7 @@
     assert(service->name);
 
     /* if service is loading, start all in ALSO_START */
-    if (IS_MARK(service, &LOADING))
+    if (IS_STARTING(service))
     {
         tmp = NULL;
         while ((tmp =
@@ -61,18 +61,15 @@
             char *fixed = NULL;
 
             fixed = fix_variables(tmp, service);
-            if (initng_active_db_find_by_name(fixed))
-            {
-                free(fixed);
-                continue;
-            }
-
-            /* HACK WARNING
-             * service name starting with "virtual/" is no idea to start, since
-             * they wont exists anyway, this is a waist of resources.
-             */
-            if (strncmp(fixed, "virtual/", 8) == 0)
+            if ((current=initng_active_db_find_by_name(fixed)))
             {
+		if(!initng_handler_start_service(current))
+		{
+		    F_("Faild to also_start %s.\n", fixed);
+		    free(fixed);
+		    continue;
+		}
+		D_("Service also_start %s alredy running.\n", fixed);
                 free(fixed);
                 continue;
             }
@@ -102,11 +99,13 @@
             fixed = fix_variables(tmp, service);
             if ((current = initng_active_db_find_by_name(fixed)))
             {
-                if (g.sys_state != STATE_STOPPING)
-                {
-                    W_("service %s also stops %s\n", service->name, fixed);
-                }
-                initng_handler_stop_service(current);
+		/* Tell this verbose */
+                D_("service %s also stops %s\n", service->name, fixed);
+		
+                if(!initng_handler_stop_service(current))
+		{
+		    F_("Coud not stop also_stop service %s\n", current->name);
+		}
             }
             free(fixed);
         }
@@ -128,7 +127,7 @@
 
     initng_service_data_types_add(&ALSO_START);
     initng_service_data_types_add(&ALSO_STOP);
-    initng_plugin_hook_add(&g.ASTATUS_CHANGE, 50, &service_state);
+    initng_plugin_hook_add(&g.IS_CHANGE, 50, &service_state);
     return (TRUE);
 }
 
@@ -137,5 +136,5 @@
     D_("module_unload();\n");
     initng_service_data_types_del(&ALSO_START);
     initng_service_data_types_del(&ALSO_STOP);
-    initng_plugin_hook_del(&g.ASTATUS_CHANGE, &service_state);
+    initng_plugin_hook_del(&g.IS_CHANGE, &service_state);
 }


More information about the Initng-svn mailing list