[Initng-svn] r2978 - in initng: plugins plugins/daemon
plugins/daemon/test plugins/pidfile plugins/respawn src
svn at initng.thinktux.net
svn at initng.thinktux.net
Fri Feb 10 11:44:53 CET 2006
Author: jimmy
Date: Fri Feb 10 11:44:52 2006
New Revision: 2978
Added:
initng/plugins/daemon/test/
- copied from r2977, initng/plugins/pidfile/test/
Removed:
initng/plugins/pidfile/
initng/plugins/respawn/
Modified:
initng/plugins/Makefile.am
initng/plugins/daemon/initng_daemon.c
initng/src/initng_static_process_types.c
initng/src/initng_static_process_types.h
initng/src/initng_static_service_types.c
initng/src/initng_static_service_types.h
initng/src/initng_static_states.c
Log:
Totally untested, probably broken.
Now uses external initng_daemon.c
Modified: initng/plugins/Makefile.am
==============================================================================
--- initng/plugins/Makefile.am (original)
+++ initng/plugins/Makefile.am Fri Feb 10 11:44:52 2006
@@ -109,10 +109,6 @@
SUBDIRS+=pause
endif
-if BUILD_PIDFILE
- SUBDIRS+=pidfile
-endif
-
if BUILD_RELOAD
SUBDIRS+=reload
endif
@@ -121,10 +117,6 @@
SUBDIRS+=renice
endif
-if BUILD_RESPAWN
- SUBDIRS+=respawn
-endif
-
if BUILD_RLPARSER
SUBDIRS+=rlparser
endif
Modified: initng/plugins/daemon/initng_daemon.c
==============================================================================
--- initng/plugins/daemon/initng_daemon.c (original)
+++ initng/plugins/daemon/initng_daemon.c Fri Feb 10 11:44:52 2006
@@ -59,6 +59,34 @@
/*
* ############################################################################
+ * # CONSTANT DEFINES #
+ * ############################################################################
+ */
+
+/*
+ * timeout waiting for a pidfile to be created
+ * after the daemon returns happily.
+ */
+#define PID_TIMEOUT 90
+
+/*
+ * Rate limit on missing pidfile warnings
+ */
+#define PID_WARN_RATE 2
+
+/*
+ * seconds that must pass between respawns
+ */
+#define MAX_RESPAWN_RATE 10
+
+/*
+ * Seconds to sleep, before a daemon is respawned.
+ */
+#define RESPAWN_SLEEP 1
+
+
+/*
+ * ############################################################################
* # LOCAL FUNCTION DEFINES #
* ############################################################################
*/
@@ -67,6 +95,8 @@
static void clear_pidfile(active_db_h * s);
static pid_t get_pidof(active_db_h * s);
static pid_t get_pidfile(active_db_h * s, int warn);
+static int check_respawn(active_db_h * service);
+static int check_for_pidfile(active_db_h * daemon);
/*
@@ -89,6 +119,7 @@
static void handle_DAEMON_START_DEPS_MET(active_db_h * daemon);
static void handle_DAEMON_STOP_DEPS_MET(active_db_h * daemon);
static void handle_DAEMON_WAIT_FOR_PID_FILE(active_db_h *daemon);
+static void handle_DAEMON_WAIT_RESP_TOUT(active_db_h * service);
/*
* ############################################################################
@@ -120,36 +151,55 @@
*/
/*
- * timeout waiting for a pidfile to be created
- * after the daemon returns happily.
+ * The name of the process, initng should probe.
*/
-#define PID_TIMEOUT 90
-
-/* Rate limit on missing pidfile warnings */
-#define PID_WARN_RATE 2
-
-/* The name of the process, initng should probe */
s_entry PIDOF = { "pid_of", STRING, &TYPE_DAEMON,
"When daemon exits, initng will look for a process with this name, and set daemon pid no to that pid."
};
-/* The filename/path of a pidfile that initng can fetch pid no */
+/*
+ * The filename/path of a pidfile that initng can fetch pid no
+ */
s_entry PIDFILE = { "pid_file", STRINGS, &TYPE_DAEMON,
"When daemon exits, initng will get pid of daemon from this file."
};
-/* Determines when initng looks for a pidfile */
+/*
+ * If a daemon forks, and exit, but a copy is running, set the forks so we know this.
+ */
s_entry FORKS = { "forks", SET, &TYPE_DAEMON,
"Does the daemon fork?"
};
/*
- * this is an internal option, that is set after the
- * service died once, and the pid is updated.
+ * Is set if daemon shud be restarted, when it dies.
*/
+s_entry RESPAWN = { "respawn", SET, &TYPE_DAEMON,
+ "If this is set and daemon dies, it will be restarted."
+};
+
+
+/*
+ * When respwaning, wait this many seconds before restarting the daemon.
+ */
+s_entry RESPAWN_PAUSE = { "respawn_pause", INT, &TYPE_DAEMON,
+ "Wait this number of seconds before respawning."
+};
+
+
+
+/*
+ * Down here, internal variables, that we use, but cant be set in the .i file.
+ */
+
+/* Set if the daemon has got the pid from pidfile */
s_entry INTERNAL_GOT_PID = { NULL, SET, &TYPE_DAEMON, NULL, NULL };
+/* Set, so we know when the timeout is */
s_entry INTERNAL_PIDFILE_TIMEOUT = { NULL, INT, &TYPE_DAEMON, NULL, NULL };
+/* Set, a warning timeout time */
s_entry INTERNAL_PID_WARN_TIME = { NULL, INT, &TYPE_DAEMON, NULL, NULL };
+/* Last time respawning, so it wont respawn to mutch */
+s_entry INTERNAL_LAST_RESPAWN = { NULL, INT, &TYPE_DAEMON, NULL };
/*
* ############################################################################
@@ -210,6 +260,12 @@
a_state_h DAEMON_WAIT_FOR_PID_FILE = { "DAEMON_WAIT_FOR_PID_FILE", IS_STARTING, &handle_DAEMON_WAIT_FOR_PID_FILE };
/*
+ * This state, is when a daemon have been stopped, and its waiting for respawn timeout.
+ */
+a_state_h DAEMON_WAIT_RESP_TOUT = { "WAIT_FOR_RESPAWN_TIMEOUT", IS_DOWN, &handle_DAEMON_WAIT_RESP_TOUT };
+
+
+/*
* Generally FAILING states, if something goes wrong, some of these are set.
*/
a_state_h DAEMON_START_DEPS_FAILED = { "DAEMON_START_DEPS_FAILED", IS_FAILED, NULL };
@@ -276,9 +332,11 @@
initng_service_data_types_add(&PIDFILE);
initng_service_data_types_add(&PIDOF);
initng_service_data_types_add(&FORKS);
+ initng_service_data_types_add(&RESPAWN);
initng_service_data_types_add(&INTERNAL_GOT_PID);
initng_service_data_types_add(&INTERNAL_PIDFILE_TIMEOUT);
initng_service_data_types_add(&INTERNAL_PID_WARN_TIME);
+ initng_service_data_types_add(&INTERNAL_LAST_RESPAWN);
/* Add some new service-states */
initng_active_state_add(&DAEMON_START_MARKED);
@@ -295,6 +353,9 @@
initng_active_state_add(&DAEMON_STOP_DEPS_FAILED);
initng_active_state_add(&DAEMON_FAIL_STARTING);
initng_active_state_add(&DAEMON_FAIL_STOPPING);
+ initng_active_state_add(&DAEMON_WAIT_RESP_TOUT);
+
+
/* return happily */
return (TRUE);
@@ -319,14 +380,17 @@
initng_active_state_del(&DAEMON_STOP_DEPS_FAILED);
initng_active_state_del(&DAEMON_FAIL_STARTING);
initng_active_state_del(&DAEMON_FAIL_STOPPING);
+ initng_active_state_del(&DAEMON_WAIT_RESP_TOUT);
/* Delete all added variables */
initng_service_data_types_del(&PIDFILE);
initng_service_data_types_del(&PIDOF);
initng_service_data_types_del(&FORKS);
+ initng_service_data_types_del(&RESPAWN);
initng_service_data_types_del(&INTERNAL_GOT_PID);
initng_service_data_types_del(&INTERNAL_PIDFILE_TIMEOUT);
initng_service_data_types_del(&INTERNAL_PID_WARN_TIME);
+ initng_service_data_types_del(&INTERNAL_LAST_RESPAWN);
/* Delete the processstypes */
initng_process_db_ptype_del(&T_DAEMON);
@@ -335,6 +399,7 @@
/* Last, delete the servicetype */
initng_service_types_del(&TYPE_DAEMON);
+
}
/*
@@ -407,7 +472,7 @@
if (g.sys_state != STATE_STARTING && g.sys_state != STATE_UP)
{
F_("Can't start daemon, when system status is: %i !\n", g.sys_state);
- initng_common_mark_service(daemon, &STOPPED);
+ initng_common_mark_service(daemon, &DAEMON_STOPPED);
return;
}
@@ -495,7 +560,7 @@
initng_common_mark_service(daemon, &DAEMON_RUNNING);
}
- /* Else Let this service stay in state DAEMON_RUN */
+ /* Else Let this service stay in state DAEMON_LAUNCH */
}
static void handle_DAEMON_STOP_DEPS_MET(active_db_h * service)
@@ -554,11 +619,6 @@
}
}
-
-
-
-
-
/*
* Is run on every interrupt for services DAEMON_WAIT_FOR_PID_FILE
*/
@@ -639,6 +699,34 @@
initng_common_mark_service(s, &RUNNING);
}
+/*
+ * When a service has quit, and shud respwan, it is set to this state.
+ * in the wait for timeout to respawn.
+ */
+static void handle_DAEMON_WAIT_RESP_TOUT(active_db_h * service)
+{
+ time_t last = 0;
+ int wait = RESPAWN_SLEEP;
+
+ last = (time_t) initng_active_db_get_int(&INTERNAL_LAST_RESPAWN, service);
+
+ if (initng_active_db_is(&RESPAWN_PAUSE, service))
+ wait = initng_active_db_get_int(&RESPAWN_PAUSE, service);
+
+ if ((g.now.tv_sec - last) < wait)
+ {
+ D_("Will sleep %i seconds before respawning!\n", wait);
+ initng_global_set_sleep(wait);
+ return;
+ }
+
+ /* If set it stopped, so it can be restarted */
+ initng_common_mark_service(service, &DAEMON_STOPPED);
+
+ /* to make sure it will be started */
+ initng_handler_start_service(service);
+}
+
/*
* ############################################################################
@@ -674,31 +762,21 @@
/*
* If the daemon is launching and not running
+ * This function fetches all daemons with DAEMON_LAUNCH state.
*/
- if (daemon->current_state == &DAEMON_LAUNCH)
+ if (check_for_pidfile(daemon))
+ return;
+
+ /* All other states here can only be DAMEON_RUNNING becouse DAEMON_LAUNCH is stuck in chec_for_pidfile */
+ if (daemon->current_state != &DAEMON_RUNNING)
{
+ F_("This is strange, an daemon exited, and is not in state DAEMON_LAUNCH or DAEMON_RUNNING, check this out.\n");
+ }
- /*
- * If pidof or pidfile is set, try fetch the pid.
- */
- if (initng_active_db_is(&PIDOF, daemon) || initng_active_db_is(&PIDFILE, daemon))
- {
- /* Set the WAIT_FOR_PIDFILE state, This will start checking for pidfiles. */
- initng_common_mark_service(daemon, &DAEMON_WAIT_FOR_PID_FILE);
-
- /* set the timeout also */
- initng_active_db_set_int(&INTERNAL_PIDFILE_TIMEOUT, daemon,
- (int) time(0) + PID_TIMEOUT);
- initng_active_db_set_int(&INTERNAL_PID_WARN_TIME, daemon, (int) time(0));
-
- /* return away from here */
- return;
- }
-
- W_("%s daemon forked, and exited, but initng have no way of getting the pid it got.\nInitng mark this daemon as running but wont notice if it dies.", daemon->name);
- initng_common_mark_service(daemon, &DAEMON_RUNNING);
+ /* This service are gonna respawn, no need to set it stopped */
+ if(check_respawn(daemon))
return;
- }
+
/*
* Make sure r_code don't signal error (can be override by UP_ON_FAILURE.
*/
@@ -752,8 +830,6 @@
if (process->pt != &T_DAEMON)
{
F_("This daemon does not have a daemon_process!\n");
- /*list_del(&process->list);
- process_db_free(process); */
return;
}
@@ -1071,3 +1147,91 @@
#endif
+
+
+
+/*
+ * ############################################################################
+ * # RESPAWN FUNCTIONS #
+ * ############################################################################
+ */
+
+/*
+ * This is a check if service will be set in a respawn mode.
+ * Will return TRUE if respawn is handled.
+ * Else false and function kan set it into stopped mode.
+ */
+static int check_respawn(active_db_h * service)
+{
+ time_t last = 0;
+
+ assert(service);
+
+ /* check if the service have respawn enabled */
+ if (!initng_active_db_is(&RESPAWN, service))
+ {
+ D_("Service %s doesn't have RESPAWN flag set, won't respawn!\n");
+ return (FALSE);
+ }
+
+ /* get times */
+ if (initng_active_db_is(&INTERNAL_LAST_RESPAWN, service))
+ last = (time_t) initng_active_db_get_int(&INTERNAL_LAST_RESPAWN, service);
+ D_("Now: %i , Last: %i\n", g.now.tv_sec, last);
+
+ /* make sure it wont respawn to often */
+ if (last)
+ {
+ if (g.now.tv_sec - last < MAX_RESPAWN_RATE)
+ {
+ W_("Won't respawn service %s, it was respawned %i seconds ago.\n",
+ service->name, g.now.tv_sec - last);
+ return (FALSE);
+ }
+ }
+
+ /* set the next INTERNAL_LAST_RESPAWN no to use. */
+ initng_active_db_set_int(&INTERNAL_LAST_RESPAWN, service, (int) g.now.tv_sec);
+
+ initng_common_mark_service(service, &DAEMON_WAIT_RESP_TOUT);
+ return (TRUE);
+}
+
+
+/*
+ * This chek is run on kill event.
+ * Will check if now is a good time to
+ * Look for a pidfile.
+ * If return TRUE no more handeling nessesary
+ */
+static int check_for_pidfile(active_db_h * daemon)
+{
+
+ /*
+ * If the daemon is launching and not running
+ */
+ if (daemon->current_state != &DAEMON_LAUNCH)
+ return(FALSE);
+
+ /*
+ * If pidof or pidfile is set, try fetch the pid.
+ */
+ if (initng_active_db_is(&PIDOF, daemon) || initng_active_db_is(&PIDFILE, daemon))
+ {
+ /* Set the WAIT_FOR_PIDFILE state, This will start checking for pidfiles. */
+ initng_common_mark_service(daemon, &DAEMON_WAIT_FOR_PID_FILE);
+
+ /* set the timeout also */
+ initng_active_db_set_int(&INTERNAL_PIDFILE_TIMEOUT, daemon,
+ (int) time(0) + PID_TIMEOUT);
+ initng_active_db_set_int(&INTERNAL_PID_WARN_TIME, daemon, (int) time(0));
+
+ /* return away from here */
+ return(TRUE);
+ }
+
+ W_("%s daemon forked, and exited, but initng have no way of getting the pid it got.\nInitng mark this daemon as running but wont notice if it dies.", daemon->name);
+ initng_common_mark_service(daemon, &DAEMON_RUNNING);
+ return(TRUE);
+}
+
Modified: initng/src/initng_static_process_types.c
==============================================================================
--- initng/src/initng_static_process_types.c (original)
+++ initng/src/initng_static_process_types.c Fri Feb 10 11:44:52 2006
@@ -39,54 +39,10 @@
#include "initng_fd.h"
#include "initng_static_data_id.h"
-static void handle_killed_daemon(active_db_h * killed_service,
- process_h * process);
-ptype_h T_DAEMON = { "daemon", &handle_killed_daemon };
-ptype_h T_KILL = { "kill", NULL };
-
void initng_static_process_types_add_default(void)
{
- initng_process_db_ptype_add(&T_DAEMON);
- initng_process_db_ptype_add(&T_KILL);
+/* initng_process_db_ptype_add(&T_DAEMON);
+ initng_process_db_ptype_add(&T_KILL);*/
}
-
-static void handle_killed_daemon(active_db_h * service, process_h * process)
-{
- assert(service);
- assert(service->name);
- assert(service->current_state);
- assert(service->current_state->state_name);
- assert(process);
-
- D_("(%s): initial status: \"%s\".\n",
- service->name, service->current_state->state_name);
-
- /* Set the universal variable, that signalize that something happened */
- initng_global_set_interrupt();
-
- /*
- * If the return code (for example "exit 1", in a bash script)
- * from the program, is bigger than 0, this commonly signalize
- * that something got wrong, print this as an error msg on screen
- */
- if (process->r_code > 0)
- {
- F_(" daemon %s, Returned with exit %i.\n", service->name,
- process->r_code);
-
- initng_common_mark_service(service, &DAEMON_EXIT_BAD);
- list_del(&process->list);
- initng_process_db_free(process);
- return;
- }
-
- /* free the process, or start_service will fail */
- list_del(&process->list);
- initng_process_db_free(process);
-
- /* OK, now accept this service as STOPPED, set this status */
- initng_common_mark_service(service, &STOPPED);
-}
-
Modified: initng/src/initng_static_process_types.h
==============================================================================
--- initng/src/initng_static_process_types.h (original)
+++ initng/src/initng_static_process_types.h Fri Feb 10 11:44:52 2006
@@ -24,11 +24,6 @@
#include "initng.h"
#include "initng_process_db.h"
-/* extern ptype_h T_START;
- extern ptype_h T_STOP; */
-extern ptype_h T_DAEMON;
-extern ptype_h T_KILL;
-
void initng_static_process_types_add_default(void);
#endif
Modified: initng/src/initng_static_service_types.c
==============================================================================
--- initng/src/initng_static_service_types.c (original)
+++ initng/src/initng_static_service_types.c Fri Feb 10 11:44:52 2006
@@ -52,16 +52,12 @@
static int start_DAEMON_or_SERVICE(active_db_h * service_to_start);
static int stop_SERVICE_or_DAEMON(active_db_h * service_to_stop);
-/*stype_h TYPE_SERVICE = { "service", &start_DAEMON_or_SERVICE, &stop_SERVICE_or_DAEMON, NULL };*/
-stype_h TYPE_DAEMON = { "daemon", &start_DAEMON_or_SERVICE, &stop_SERVICE_or_DAEMON, NULL };
stype_h TYPE_VIRTUAL = { "virtual", &start_DAEMON_or_SERVICE, &stop_SERVICE_or_DAEMON, NULL };
stype_h TYPE_RUNLEVEL = { "runlevel", &start_DAEMON_or_SERVICE, &stop_SERVICE_or_DAEMON, NULL };
stype_h TYPE_CLASS = { "class", NULL, NULL, NULL };
void initng_service_add_static_stypes(void)
{
-/* initng_service_types_add(&TYPE_SERVICE);*/
- initng_service_types_add(&TYPE_DAEMON);
initng_service_types_add(&TYPE_VIRTUAL);
initng_service_types_add(&TYPE_RUNLEVEL);
initng_service_types_add(&TYPE_CLASS);
Modified: initng/src/initng_static_service_types.h
==============================================================================
--- initng/src/initng_static_service_types.h (original)
+++ initng/src/initng_static_service_types.h Fri Feb 10 11:44:52 2006
@@ -25,8 +25,6 @@
#include <time.h>
#include "initng_active_db.h"
-/* extern stype_h TYPE_SERVICE;*/
-extern stype_h TYPE_DAEMON;
extern stype_h TYPE_VIRTUAL;
extern stype_h TYPE_RUNLEVEL;
Modified: initng/src/initng_static_states.c
==============================================================================
--- initng/src/initng_static_states.c (original)
+++ initng/src/initng_static_states.c Fri Feb 10 11:44:52 2006
@@ -58,7 +58,6 @@
static void handle_STOP_DEP_MET(active_db_h * service_to_stop);
static void handle_STOPPED(active_db_h * service_to_stop);
static void handle_STOP_MARKED(active_db_h * service);
-static void kill_daemon(active_db_h * service_to_stop);
/*
@@ -185,28 +184,6 @@
}
-static void handle_START_DEP_MET_daemon(active_db_h * service_to_start)
-{
- if (!initng_common_mark_service(service_to_start, &STARTING))
- return;
-
- switch (initng_execute_launch(service_to_start, &T_DAEMON))
- {
- case FALSE:
- case FAIL:
- F_("Service %s, could not launch a daemon!\n",
- service_to_start->name);
- initng_common_mark_service(service_to_start, &FAIL_STARTING);
- return; /* return with status */
- default:
- break;
- }
-
- /* a daemon is "UP" when its launched */
- initng_common_mark_service(service_to_start, &RUNNING);
-}
-
-
static void handle_START_DEP_MET(active_db_h * service_to_start)
{
assert(service_to_start);
@@ -223,17 +200,6 @@
initng_common_mark_service(service_to_start, &DONE);
return;
}
-/*
- else if (service_to_start->type == &TYPE_SERVICE)
- {
- handle_START_DEP_MET_service(service_to_start);
- return;
- }*/
- else if (service_to_start->type == &TYPE_DAEMON)
- {
- handle_START_DEP_MET_daemon(service_to_start);
- return;
- }
F_("DEP MET BUT CANT HANDLE!\n");
initng_common_mark_service(service_to_start, &FAIL_STARTING);
@@ -310,75 +276,9 @@
-static void handle_STOP_DEP_MET_daemon(active_db_h * service_to_stop)
-{
- process_h *process, *safe = NULL;
-
- /* mark this service as STOPPING */
- initng_common_mark_service(service_to_stop, &STOPPING);
-
- /* find the daemon, and check so it still exits */
- while_processes_safe(process, safe, service_to_stop)
- {
- if (process->pt != &T_DAEMON)
- continue;
-
- if (process->pid <= 0)
- {
- initng_common_mark_service(service_to_stop, &STOPPED);
- return;
- }
-
- if (kill(process->pid, 0) && errno == ESRCH)
- {
- initng_common_mark_service(service_to_stop, &STOPPED);
- return;
- }
- }
-
- /* launch stop service */
- switch (initng_execute_launch(service_to_stop, &T_KILL))
- {
- case FAIL:
- F_(" -- (%s): fail launch stop!\n", service_to_stop->name);
- initng_common_mark_service(service_to_stop, &FAIL_STOPPING);
- return;
- case FALSE:
- /* if there is no plugin that wanna kill this daemon,
- * we do it ourself.
- */
- kill_daemon(service_to_stop);
- break;
- default:
- break;
- }
-
- if (initng_active_db_is(&STOP_TIMEOUT, service_to_stop))
- {
- initng_global_set_sleep(initng_active_db_get_int
- (&STOP_TIMEOUT, service_to_stop) + 1);
- }
- else
- {
- initng_global_set_sleep(SECONDS_BEFORE_KILL + 1);
- }
-
-}
static void handle_STOP_DEP_MET(active_db_h * service_to_stop)
{
-/*
- if (service_to_stop->type == &TYPE_SERVICE)
- {
- handle_STOP_DEP_MET_service(service_to_stop);
- return;
- }
-*/
- if (service_to_stop->type == &TYPE_DAEMON)
- {
- handle_STOP_DEP_MET_daemon(service_to_stop);
- return;
- }
if (service_to_stop->type == &TYPE_VIRTUAL)
{
@@ -390,76 +290,6 @@
F_("DON'T KNOW HOW TO STOP %s!\n", service_to_stop->name);
}
-static void kill_daemon(active_db_h * service_to_stop)
-{
- process_h *process = NULL;
-
- assert(service_to_stop);
-
- /* look for a T_DAEMON process */
- while_processes(process, service_to_stop)
- {
- if (process->pt == &T_DAEMON)
- break;
- }
-
- /* make sure we got a process */
- if (!process)
- {
- F_("Service doesn't have any processes, don't know how to kill then.\n");
- return;
- }
-
- /* check so we got a T_DAEMON */
- if (process->pt != &T_DAEMON)
- {
- F_("This daemon does not have a daemon_process!\n");
- /*list_del(&process->list);
- process_db_free(process); */
- return;
- }
-
- /* check so that pid is good */
- if (process->pid <= 0)
- {
- F_("Bad PID %d in database!\n", process->pid);
- list_del(&process->list);
- initng_process_db_free(process);
- return;
- }
-
- /* check so there exits an process with this pid */
- if (kill(process->pid, 0) && errno == ESRCH)
- {
- F_("Trying to kill a service (%s) with a pid (%d), but there exists no process with this pid!\n", service_to_stop->name, process->pid);
- list_del(&process->list);
- initng_process_db_free(process);
- return;
- }
-
- /* if system is not stopping, generate a warning */
- if (g.sys_state != STATE_STOPPING)
- {
- W_(" Sending the process %i of %s, the SIGTERM signal!\n",
- process->pid, service_to_stop->name);
- }
-
- /* Uhm, this doesn't work : kill(-service_to_stop->start_process->pid, SIGTERM); */
- kill(process->pid, SIGTERM);
-
- if (initng_active_db_is(&STOP_TIMEOUT, service_to_stop))
- {
- initng_global_set_sleep(initng_active_db_get_int
- (&STOP_TIMEOUT, service_to_stop) + 1);
- D_("Clock is set, killed process %i (%s), have %i seconds to quit before SIGKILL\n", process->pid, service_to_stop->name, initng_active_db_get_int(&STOP_TIMEOUT, service_to_stop));
- }
- else
- {
- initng_global_set_sleep(SECONDS_BEFORE_KILL + 1);
- D_("Clock is set, killed process %i (%s), have %i seconds to quit before SIGKILL\n", process->pid, service_to_stop->name, SECONDS_BEFORE_KILL);
- }
-}
-
static void handle_STOPPED(active_db_h * service_stopped)
{
active_db_h *current, *safe = NULL;
More information about the Initng-svn
mailing list