201 |
} |
} |
202 |
|
|
203 |
if(toggle_validate_flag) { |
if(toggle_validate_flag) { |
204 |
|
|
205 |
if( is(action, "start")) { |
if( is(action, "start")) { |
206 |
LOCK(Run.mutex) |
LOCK(Run.mutex) |
207 |
p->do_validate= TRUE; |
p->do_validate= TRUE; |
|
END_LOCK; |
|
|
|
|
|
if(Run.debug) |
|
|
log("Monitoring enabled -- process %s\n", p->name); |
|
|
|
|
|
} |
|
|
|
|
|
if( is(action, "stop")) { |
|
|
LOCK(Run.mutex) |
|
|
p->do_validate= FALSE; |
|
208 |
END_LOCK; |
END_LOCK; |
209 |
|
|
210 |
if(Run.debug) |
if(Run.debug) |
211 |
log("Monitoring disabled -- process %s\n", p->name); |
log("Monitoring enabled -- process %s\n", p->name); |
|
|
|
212 |
} |
} |
213 |
|
} |
214 |
|
|
|
} |
|
|
|
|
215 |
if(is(action, "start")) { |
if(is(action, "start")) { |
216 |
|
|
217 |
if(is_process_running(p)) { |
if(is_process_running(p)) { |
218 |
return; |
return; |
219 |
} |
} |
220 |
|
|
221 |
if(!p->start) { |
if(!p->start) { |
222 |
error("%s: Start method not defined -- process %s\n", |
error("%s: Start method not defined -- process %s\n", |
223 |
prog, P); |
prog, P); |
240 |
|
|
241 |
} |
} |
242 |
|
|
243 |
|
if(toggle_validate_flag) { |
244 |
|
|
245 |
|
if( is(action, "stop")) { |
246 |
|
LOCK(Run.mutex) |
247 |
|
p->do_validate= FALSE; |
248 |
|
END_LOCK; |
249 |
|
|
250 |
|
if(Run.debug) |
251 |
|
log("Monitoring disabled -- process %s\n", p->name); |
252 |
|
} |
253 |
|
} |
254 |
|
|
255 |
} |
} |
256 |
|
|
257 |
|
|
302 |
} |
} |
303 |
} |
} |
304 |
|
|
305 |
if(p->start && (!is_process_running(p))) { |
if(p->start && p->do_validate && (!is_process_running(p))) { |
306 |
log("start: (%s) %s\n", p->name, p->start->arg[0]); |
log("start: (%s) %s\n", p->name, p->start->arg[0]); |
307 |
spawn(p, p->start); |
spawn(p, p->start); |
308 |
/* Wait until the process is actually started */ |
/* Wait until the process is actually started */ |
332 |
|
|
333 |
p->depend_visited= TRUE; |
p->depend_visited= TRUE; |
334 |
|
|
335 |
if(p->stop && is_process_running(p)) { |
if(p->stop && p->do_validate && is_process_running(p)) { |
336 |
log("stop: (%s) %s\n", p->name, p->stop->arg[0]); |
log("stop: (%s) %s\n", p->name, p->stop->arg[0]); |
337 |
spawn(p, p->stop); |
spawn(p, p->stop); |
338 |
memset(p->procinfo, 0, sizeof *(p->procinfo)); |
memset(p->procinfo, 0, sizeof *(p->procinfo)); |
383 |
for(d= parent->dependantlist; d; d= d->next) |
for(d= parent->dependantlist; d; d= d->next) |
384 |
if(is(d->dependant, p->name)) |
if(is(d->dependant, p->name)) |
385 |
break; |
break; |
386 |
if(d && p->stop && p->start) { |
if(d && p->stop && p->start && p->do_validate) { |
387 |
|
|
388 |
if(is(action, "stop")) { |
if(is(action, "stop")) { |
389 |
if(is_process_running(parent)) { |
if(is_process_running(parent)) { |