[Initng-svn] r3675 - in initng/trunk/plugins: cpout fstat rlparser runlevel service simple_launcher stcmd stdout suid syncron syslog unneeded usplash

svn at initng.thinktux.net svn at initng.thinktux.net
Wed Apr 5 01:39:18 CEST 2006


Author: jimmy
Date: Wed Apr  5 01:39:16 2006
New Revision: 3675

Modified:
   initng/trunk/plugins/cpout/initng_colorprint_out.c
   initng/trunk/plugins/fstat/initng_fstat.c
   initng/trunk/plugins/rlparser/PLUGIN_DESCRIPTION
   initng/trunk/plugins/runlevel/PLUGIN_DESCRIPTION
   initng/trunk/plugins/service/PLUGIN_DESCRIPTION
   initng/trunk/plugins/simple_launcher/PLUGIN_DESCRIPTION
   initng/trunk/plugins/stcmd/PLUGIN_DESCRIPTION
   initng/trunk/plugins/stdout/PLUGIN_DESCRIPTION
   initng/trunk/plugins/suid/PLUGIN_DESCRIPTION
   initng/trunk/plugins/syncron/PLUGIN_DESCRIPTION
   initng/trunk/plugins/syslog/PLUGIN_DESCRIPTION
   initng/trunk/plugins/unneeded/PLUGIN_DESCRIPTION
   initng/trunk/plugins/usplash/PLUGIN_DESCRIPTION
Log:
Finished all PLUGIN_DESCRIPTION, did remove the percent marker when service is not starting or stopping,
and rewrote  initng_fstat.c


Modified: initng/trunk/plugins/cpout/initng_colorprint_out.c
==============================================================================
--- initng/trunk/plugins/cpout/initng_colorprint_out.c	(original)
+++ initng/trunk/plugins/cpout/initng_colorprint_out.c	Wed Apr  5 01:39:16 2006
@@ -90,12 +90,19 @@
 
     clear_lastserv();
     if (t > 1)
-        printf(PE "\t[" C_GREEN "done" C_OFF
-               "]  \t( done in %ims )\n", initng_active_db_percent_started(),
-               s->name, t);
+    {
+	if(g.sys_state==STATE_STARTING)
+    	    printf(PE "\t[" C_GREEN "done" C_OFF "]  \t( done in %ims )\n", initng_active_db_percent_started(), s->name, t);
+	else
+    	    printf(P "\t[" C_GREEN "done" C_OFF "]  \t( done in %ims )\n", s->name, t);
+    }	
     else
-        printf(PE "\t[" C_GREEN "done" C_OFF "]\n",
-               initng_active_db_percent_started(), s->name);
+    {
+	if(g.sys_state==STATE_STARTING)
+    	    printf(PE "\t[" C_GREEN "done" C_OFF "]\n", initng_active_db_percent_started(), s->name);
+	else
+    	    printf(P "\t[" C_GREEN "done" C_OFF "]\n", s->name);
+    }
 }
 
 static void opt_service_stop_p(active_db_h * s, const char *is)
@@ -108,7 +115,7 @@
     t = MS_DIFF(s->time_current_state, s->time_last_state);
 
     clear_lastserv();
-    if (t > 1)
+    if (t > 1 && g.sys_state==STATE_STOPPING)
         printf(PE "\t[" C_GREEN "%s" C_OFF
                "]\t( %s in %ims )\n", initng_active_db_percent_stopped(),
                s->name, is, is, t);
@@ -135,18 +142,17 @@
 
     if (IS_STARTING(service))
     {
-
         /* if we print this on boot, we clutter up the screen too much */
         if (g.sys_state == STATE_STARTING)
             return (TRUE);
         clear_lastserv();
-        printf(PE "\t[" C_GREEN "starting" C_OFF "]\n",
-               initng_active_db_percent_started(), service->name);
+        printf(P "\t[" C_GREEN "starting" C_OFF "]\n", service->name);
         return (TRUE);
     }
 
     if (IS_UP(service))
     {
+	int t;
         process_h *process = initng_process_db_get_by_name("daemon", service);
 
         if (!process)
@@ -155,9 +161,15 @@
             return (TRUE);
         }
         clear_lastserv();
-        printf(PE "\t[" C_GREEN "started" C_OFF "]\t( pid: %i )\n",
-               initng_active_db_percent_started(), service->name,
-               process->pid);
+	t=initng_active_db_percent_started();
+	
+	if (t > 1 && g.sys_state==STATE_STARTING)
+    	    printf(PE "\t[" C_GREEN "started" C_OFF "]\t( pid: %i )\n",
+               t, service->name, process->pid);
+	else
+    	    printf(P"\t[" C_GREEN "started" C_OFF "]\t( pid: %i )\n",
+               service->name, process->pid);
+	    
         return (TRUE);
     }
 

Modified: initng/trunk/plugins/fstat/initng_fstat.c
==============================================================================
--- initng/trunk/plugins/fstat/initng_fstat.c	(original)
+++ initng/trunk/plugins/fstat/initng_fstat.c	Wed Apr  5 01:39:16 2006
@@ -34,13 +34,26 @@
 #include <initng_static_data_id.h>
 #include <initng_static_states.h>
 
-s_entry FILES_TO_EXIST = { "require_file", STRINGS, NULL,
+s_entry WAIT_FOR_FILE = { "wait_for_file", STRINGS, NULL,
     "Check so that this files exits before launching."
 };
-s_entry FILES_TO_EXIST_AFTER = { "files_to_exist_after", STRINGS, NULL,
-    "Make sure this files exits after service is launched, or mark failed."
+
+s_entry REQUIRE_FILE = { "require_file", STRINGS, NULL,
+    "If this file dont exist, this service will FAIL directly."
+};
+
+s_entry WAIT_FOR_FILE_AFTER = { "wait_for_file_after", STRINGS, NULL,
+    "Make sure this files exits before a service can be marked as up."
 };
 
+s_entry REQUIRE_FILE_AFTER = { "require_file_after", STRINGS, NULL,
+    "If this file dont exist after, the service will be marked FAIL."
+};
+
+a_state_h REQUIRE_FILE_FAILED = { "REQUIRE_FILE_FAILED", IS_FAILED, NULL, NULL, NULL };
+a_state_h REQUIRE_FILE_AFTER_FAILED = { "REQUIRE_FILE_AFTER_FAILED", IS_FAILED, NULL, NULL, NULL };
+
+
 
 /*
  * Do this check before START_DEP_MET can be set.
@@ -51,7 +64,8 @@
     s_data *itt = NULL;
     struct stat file_stat;
 
-    while ((file = get_next_string(&FILES_TO_EXIST, service, &itt)))
+    /* CHECK WAIT_FOR_FILE */
+    while ((file = get_next_string(&WAIT_FOR_FILE, service, &itt)))
     {
         D_("Service %s need file %s to exist\n", service->name, file);
         if (stat(file, &file_stat) != 0)
@@ -64,6 +78,18 @@
             return (FALSE);
         }
     }
+
+    /* CHECK REQUIRE_FILE */
+    while ((file = get_next_string(&REQUIRE_FILE, service, &itt)))
+    {
+        D_("Service %s need file %s to exist\n", service->name, file);
+        if (stat(file, &file_stat) != 0)
+	{
+	    initng_common_mark_service(service, &REQUIRE_FILE_FAILED);
+	    return(FALSE);
+	}
+    }
+
     return (TRUE);
 }
 
@@ -77,7 +103,8 @@
 
     struct stat file_stat;
 
-    while ((file = get_next_string(&FILES_TO_EXIST_AFTER, service, &itt)))
+    /* check WAIT_FOR_FILE_AFTER */
+    while ((file = get_next_string(&WAIT_FOR_FILE_AFTER, service, &itt)))
     {
         D_("Service %s need file %s before it can be set to RUNNING\n",
            service->name, file);
@@ -91,6 +118,17 @@
             return (FALSE);
         }
     }
+
+    /* check REQUIRE_FILE_AFTER */
+    while ((file = get_next_string(&WAIT_FOR_FILE_AFTER, service, &itt)))
+    {
+        if (stat(file, &file_stat) != 0)
+        {
+	    initng_common_mark_service(service, &REQUIRE_FILE_AFTER_FAILED);
+	    return(FALSE);
+	}
+    }
+    	
     return (TRUE);
 }
 
@@ -103,8 +141,14 @@
         return (FALSE);
     }
 
-    initng_service_data_types_add(&FILES_TO_EXIST);
-    initng_service_data_types_add(&FILES_TO_EXIST_AFTER);
+    initng_service_data_types_add(&WAIT_FOR_FILE);
+    initng_service_data_types_add(&REQUIRE_FILE);
+    initng_service_data_types_add(&WAIT_FOR_FILE_AFTER);
+    initng_service_data_types_add(&REQUIRE_FILE_AFTER);
+
+    initng_active_state_add(&REQUIRE_FILE_FAILED);
+    initng_active_state_add(&REQUIRE_FILE_AFTER_FAILED);
+
     initng_plugin_hook_add(&g.START_DEP_MET, 55, &check_files_to_exist);
     initng_plugin_hook_add(&g.UP_MET, 55, &check_files_to_exist_after);
     return (TRUE);
@@ -113,8 +157,14 @@
 void module_unload(void)
 {
     S_;
-    initng_service_data_types_del(&FILES_TO_EXIST);
-    initng_service_data_types_del(&FILES_TO_EXIST_AFTER);
+    initng_service_data_types_del(&WAIT_FOR_FILE);
+    initng_service_data_types_del(&REQUIRE_FILE);
+    initng_service_data_types_del(&WAIT_FOR_FILE_AFTER);
+    initng_service_data_types_del(&REQUIRE_FILE_AFTER);
+
+    initng_active_state_del(&REQUIRE_FILE_FAILED);
+    initng_active_state_del(&REQUIRE_FILE_AFTER_FAILED);
+
     initng_plugin_hook_del(&g.START_DEP_MET, &check_files_to_exist);
     initng_plugin_hook_del(&g.UP_MET, &check_files_to_exist_after);
 }

Modified: initng/trunk/plugins/rlparser/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/rlparser/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/rlparser/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,6 @@
-          name : 
+          name : rlparser
         author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
   contributors : 
       commands : 
        options : 
-   description : 
\ No newline at end of file
+   description : Parses *.runlevel and *.virtual files from /etc/initng
\ No newline at end of file

Modified: initng/trunk/plugins/runlevel/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/runlevel/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/runlevel/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,10 @@
-          name : 
+          name : runlevel
         author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
   contributors : 
       commands : 
        options : 
-   description : 
\ No newline at end of file
+ service_types : runlevel, virtual
+        states : START_MARKED, STOP_MARKED, UP, WAITING_FOR_START_DEP, WAITING_FOR_STOP_DEP,
+	         DOWN, START_DEPS_FAILED, FAIL_STARTING, FAIL_STOPPING
+   description : Runlevel or virutal works like a service but will only handle
+                 depndencys and not launch any code.

Modified: initng/trunk/plugins/service/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/service/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/service/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,17 @@
-          name : 
+          name : service
         author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
   contributors : 
       commands : 
-       options : 
-   description : 
\ No newline at end of file
+       options : start_timeout, stop_timeout, never_kill, start_fail_ok, stop_fail_ok
+ service_types : service
+ process_types : start, stop
+        states : SERVICE_START_MARKED, SERVICE_STOP_MARKED, SERVICE_DONE, SERVICE_WAITING_FOR_STOP_DEP,
+                 SERVICE_START_DEPS_MET, SERVICE_STOP_DEPS_MET, SERVICE_STOPPED, SERVICE_START_RUN
+		 SERVICE_STOP_RUN, SERVICE_START_DEPS_FAILED, SERVICE_STOP_DEPS_FAILED,
+		 SERVICE_FAIL_STARTING, SERVICE_FAIL_STOPPING, SERVICE_START_FAILED_TIMEOUT,
+		 SERVICE_STOP_FAILED_TIMEOUT, SERVICE_UP_CHECK_FAILED
+   description : A service meens a object with an start and maby an stop launcher.
+                 It works by that starting an object the start code run, when it
+		 finishes, and succeed, the object is set to UP, later when stopping
+		 it the stop code is run, and when that finishes, the object got status
+		 DOWN. This is not like a daemon works, that is up when launced.
\ No newline at end of file

Modified: initng/trunk/plugins/simple_launcher/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/simple_launcher/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/simple_launcher/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,7 @@
-          name : 
+          name : simple_launcher
         author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
   contributors : 
       commands : 
-       options : 
-   description : 
\ No newline at end of file
+       options : exec, exec_path, exec_args
+   description : This launcher is more simple then launching a script,
+                 This one simple launches an executable with right enviroments.
\ No newline at end of file

Modified: initng/trunk/plugins/stcmd/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/stcmd/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/stcmd/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,10 @@
-          name : 
+          name : stcmd
         author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
   contributors : 
-      commands : 
+      commands : get_pid_of, restart_from, zap, restart, time, reload_service, poweroff,
+                 halt, reboot, print_plugins, load_module, unload_module, done, father,
+                 service_dep_on, service_dep_on_deep, service_dep_on_me,
+		 service_dep_on_me_deep, new_init 
        options : 
-   description : 
\ No newline at end of file
+   description : This plugin contains some werry basic commands, that user can use
+                 to control initng.
\ No newline at end of file

Modified: initng/trunk/plugins/stdout/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/stdout/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/stdout/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -2,5 +2,7 @@
         author : Neuron <neuron at hollowtube.mine.nu>
   contributors : Jimmy Wennlund <jimmy.wennlund at gmail.com>
       commands : 
-       options : 
-   description : 
\ No newline at end of file
+       options : stdout, stderr, stdall, stdin
+   description : This plugins redirect the output to a file or socket/pipe
+                 before launching, if you redirecting output away from initng
+		 it wont be printed, or get in the logs, or history.
\ No newline at end of file

Modified: initng/trunk/plugins/suid/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/suid/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/suid/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,6 @@
-          name : 
+          name : suid
         author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
   contributors : 
       commands : 
-       options : 
-   description : 
\ No newline at end of file
+       options : suid, sgid
+   description : Set user and goup id before launching.
\ No newline at end of file

Modified: initng/trunk/plugins/syncron/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/syncron/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/syncron/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -2,5 +2,8 @@
         author : Neuron <neuron at hollowtube.mine.nu>
   contributors : Jimmy Wennlund <jimmy.wennlund at gmail.com>
       commands : 
-       options : 
-   description : 
\ No newline at end of file
+       options : syncron
+  cmd_line_opt : synchronously
+   description : IF syncron or synchronously is set, initng will make sure that there
+                 is not two service starting at the same time in the system, good for
+		 use when debugging, or with interactive plugin.
\ No newline at end of file

Modified: initng/trunk/plugins/syslog/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/syslog/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/syslog/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,6 @@
-          name : 
+          name : syslog
         author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
   contributors : 
       commands : 
        options : 
-   description : 
\ No newline at end of file
+   description : This plugin outputs events and process output to syslogd.
\ No newline at end of file

Modified: initng/trunk/plugins/unneeded/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/unneeded/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/unneeded/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,7 @@
-          name : 
+          name : unneeded
         author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
   contributors : 
-      commands : 
+      commands : stop_unneeded
        options : 
-   description : 
\ No newline at end of file
+   description : This simple plugins try to find all services that nothing depends on and
+                 shut them down, good for cleaning the system out of manually started services.
\ No newline at end of file

Modified: initng/trunk/plugins/usplash/PLUGIN_DESCRIPTION
==============================================================================
--- initng/trunk/plugins/usplash/PLUGIN_DESCRIPTION	(original)
+++ initng/trunk/plugins/usplash/PLUGIN_DESCRIPTION	Wed Apr  5 01:39:16 2006
@@ -1,6 +1,6 @@
-          name : 
-        author : Jimmy Wennlund <jimmy.wennlund at gmail.com>
+          name : usplash
+        author : Anders Aagaard <aagaande at gmail.com>
   contributors : 
       commands : 
        options : 
-   description : 
\ No newline at end of file
+   description : A plugin to handle usplash output.
\ No newline at end of file


More information about the Initng-svn mailing list