73 |
static int do_stop(Service_T); |
static int do_stop(Service_T); |
74 |
static void do_monitor(Service_T); |
static void do_monitor(Service_T); |
75 |
static void do_unmonitor(Service_T); |
static void do_unmonitor(Service_T); |
|
static void monitor_set(Service_T); |
|
76 |
static void *wait_start(void *); |
static void *wait_start(void *); |
77 |
static int wait_stop(Service_T); |
static int wait_stop(Service_T); |
78 |
static void do_depend(Service_T, const char *); |
static void do_depend(Service_T, const char *); |
141 |
|
|
142 |
if(s->type==TYPE_PROCESS && Util_isProcessRunning(s)) { |
if(s->type==TYPE_PROCESS && Util_isProcessRunning(s)) { |
143 |
DEBUG("%s: Process already running -- process %s\n", prog, S); |
DEBUG("%s: Process already running -- process %s\n", prog, S); |
144 |
monitor_set(s); |
Util_monitorSet(s); |
145 |
return; |
return; |
146 |
} |
} |
147 |
|
|
148 |
if(s->type==TYPE_PROCESS && !s->start) { |
if(s->type==TYPE_PROCESS && !s->start) { |
149 |
DEBUG("%s: Start method not defined -- process %s\n", prog, S); |
DEBUG("%s: Start method not defined -- process %s\n", prog, S); |
150 |
monitor_set(s); |
Util_monitorSet(s); |
151 |
return; |
return; |
152 |
} |
} |
153 |
|
|
170 |
|
|
171 |
if(s->type==TYPE_PROCESS && (!s->start || !s->stop)) { |
if(s->type==TYPE_PROCESS && (!s->start || !s->stop)) { |
172 |
DEBUG("%s: Start or stop method not defined -- process %s\n", prog, S); |
DEBUG("%s: Start or stop method not defined -- process %s\n", prog, S); |
173 |
monitor_set(s); |
Util_monitorSet(s); |
174 |
return; |
return; |
|
} else { |
|
|
log("'%s' trying to restart\n", s->name); |
|
175 |
} |
} |
176 |
|
|
177 |
|
log("'%s' trying to restart\n", s->name); |
178 |
|
|
179 |
do_depend(s, "stop"); |
do_depend(s, "stop"); |
180 |
if(do_stop(s)) { |
if(do_stop(s)) { |
271 |
} |
} |
272 |
} |
} |
273 |
|
|
274 |
monitor_set(s); |
Util_monitorSet(s); |
275 |
|
|
276 |
} |
} |
277 |
|
|
335 |
} |
} |
336 |
} |
} |
337 |
|
|
338 |
monitor_set(s); |
Util_monitorSet(s); |
339 |
|
|
340 |
} |
} |
341 |
|
|
358 |
} |
} |
359 |
|
|
360 |
|
|
|
/* |
|
|
* This will enable service monitoring in the case that it was disabled |
|
|
* @param s A Service_T object |
|
|
*/ |
|
|
static void monitor_set(Service_T s) { |
|
|
|
|
|
ASSERT(s); |
|
|
|
|
|
if(!s->monitor) { |
|
|
s->monitor= MONITOR_INIT; |
|
|
DEBUG("Monitoring enabled -- service %s\n", s->name); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
361 |
/* |
/* |
362 |
* This is an in-fix recursive function called before s is started to |
* This is an in-fix recursive function called before s is started to |
363 |
* stop every service that depends on s, in reverse order *or* after s |
* stop every service that depends on s, in reverse order *or* after s |