diff -u -p monit-3.0/l.l monit-monex-3.0/l.l --- monit-3.0/l.l Thu Sep 5 16:04:24 2002 +++ monit-monex-3.0/l.l Fri Oct 18 17:19:22 2002 @@ -133,6 +133,7 @@ nntp { return NNTP; } autostart { return AUTOSTART; } yes { return YES; } no { return NO; } +started { return STARTED; } group { return GROUP; } request { return REQUEST; } cpuusage { return CPUUSAGE; } diff -u -p monit-3.0/monitor.h monit-monex-3.0/monitor.h --- monit-3.0/monitor.h Thu Sep 12 19:01:40 2002 +++ monit-monex-3.0/monitor.h Fri Oct 18 16:54:27 2002 @@ -221,6 +221,8 @@ typedef struct myprocess { Command_T start; /**< The start command for the process */ Command_T stop; /**< The stop command for the process */ int do_validate; /**< validation flag, if FALSE, no validation is done */ + int do_validate_started; /**< validation, if FALSE, no validation is done */ + int started; /**< started, if FALSE, no start is done */ int ncycle; /**< The number of the current cycle */ int nstart; /**< The number of current starts with this process */ int to_start; /**< Timeout start ceiling */ diff -u -p monit-3.0/p.y monit-monex-3.0/p.y --- monit-3.0/p.y Fri Oct 18 17:33:20 2002 +++ monit-monex-3.0/p.y Fri Oct 18 17:18:45 2002 @@ -170,7 +170,7 @@ %token NUMBER %token REAL %token CPUUSAGE MEMUSAGE MEMKBYTE CYCLES RESOURCE LOADAVG1 LOADAVG5 LOADAVG15 -%token AUTOSTART YES NO +%token AUTOSTART YES NO STARTED %token GROUP REQUEST %nonassoc CHECKSUM @@ -418,8 +418,9 @@ program : PATH { addchecksum($1, | PATH EXPECT STRING { addchecksum($1, $3); } ; -autostart : AUTOSTART YES { current->do_validate=TRUE; } - | AUTOSTART NO { current->do_validate=FALSE; } +autostart : AUTOSTART YES { current->do_validate=TRUE; current->do_validate_started=TRUE; } + | AUTOSTART NO { current->do_validate=FALSE; current->do_validate_started=FALSE; } + | AUTOSTART STARTED { current->do_validate=FALSE; current->do_validate_started=TRUE; } ; group : GROUP STRING { current->group= $2; } @@ -579,6 +580,8 @@ static void createprocess(char *name, ch /* Set default values */ current->do_validate= TRUE; + current->do_validate_started= TRUE; + current->started = FALSE; current->name= name; current->pidfile= pidfile; diff -u -p monit-3.0/start.c monit-monex-3.0/start.c --- monit-3.0/start.c Fri Sep 6 20:13:37 2002 +++ monit-monex-3.0/start.c Mon Oct 21 17:51:06 2002 @@ -112,6 +112,9 @@ void start_process(Process_T p) { } log("Start: (%s) %s\n", p->name, p->start->arg[0]); + p->started=TRUE; + if (p->do_validate_started) + p->do_validate=TRUE; spawn(p, p->start); diff -u -p monit-3.0/stop.c monit-monex-3.0/stop.c --- monit-3.0/stop.c Fri Sep 6 20:13:37 2002 +++ monit-monex-3.0/stop.c Fri Oct 18 16:59:33 2002 @@ -108,7 +108,7 @@ void stop_process(Process_T p) { return; } - + p->started = FALSE; log("Stop: (%s) %s\n", p->name, p->stop->arg[0]); spawn(p, p->stop); diff -u -p monit-3.0/validate.c monit-monex-3.0/validate.c --- monit-3.0/validate.c Fri Oct 18 17:33:20 2002 +++ monit-monex-3.0/validate.c Fri Oct 18 17:32:17 2002 @@ -363,7 +363,7 @@ static void do_stop(Process_T p, char *m static int do_not_validate(Process_T p) { return (!p->do_validate || check_skip(p) || check_timeout(p) || - check_checksum(p)); + check_checksum(p) || !(p->do_validate_started && p->started)); }