/[monit]/monit/p.y
ViewVC logotype

Diff of /monit/p.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.86 by hauk, Sat Jul 19 01:13:05 2003 UTC revision 1.87 by hauk, Sun Jul 20 00:30:31 2003 UTC
# Line 111  Line 111 
111      char *pathname;      char *pathname;
112      int  operator;      int  operator;
113      int  time;      int  time;
114        int  test_changes;
115      int  action;      int  action;
116    };    };
117    
# Line 181  Line 182 
182    static void check_every(int);    static void check_every(int);
183    static int  check_perm(int);    static int  check_perm(int);
184    static void check_hostname (char *);    static void check_hostname (char *);
185      static void check_exec(char *);
186    static void createinfo();    static void createinfo();
187    static char *append_hostname(char *);    static char *append_hostname(char *);
188    static void cleanup_md5_string(char *);    static void cleanup_md5_string(char *);
# Line 214  Line 216 
216  %token AUTOSTART MODE ACTIVE PASSIVE MANUAL  %token AUTOSTART MODE ACTIVE PASSIVE MANUAL
217  %token GROUP REQUEST DEPENDS  %token GROUP REQUEST DEPENDS
218  %token UID GID ENVIRONMENT  %token UID GID ENVIRONMENT
219  %token TIMESTAMP SECOND MINUTE HOUR DAY  %token TIMESTAMP CHANGED SECOND MINUTE HOUR DAY
220  %token SSLAUTO SSLV2 SSLV3 TLSV1  %token SSLAUTO SSLV2 SSLV3 TLSV1
221  %token BYTE KILOBYTE MEGABYTE GIGABYTE  %token BYTE KILOBYTE MEGABYTE GIGABYTE
222  %token INODE SPACE PERM  %token INODE SPACE PERM
# Line 271  optproc         : start Line 273  optproc         : start
273                  | depend                  | depend
274                  | resource resourcecycle action {                  | resource resourcecycle action {
275                     resourceset.action= $<number>3;                     resourceset.action= $<number>3;
                    if((resourceset.action == ACTION_EXEC) && command) {  
                      command->events |= EVENT_RESOURCE;  
                      addcommand(EXEC);  
                    }  
276                     addresource(&resourceset);                     addresource(&resourceset);
277                    }                    }
278                  ;                  ;
# Line 752  timestamp       : TIMESTAMP PATH operato Line 750  timestamp       : TIMESTAMP PATH operato
750                      timestampset.operator= $<number>3;                      timestampset.operator= $<number>3;
751                      timestampset.time= ($4 * $<number>5);                      timestampset.time= ($4 * $<number>5);
752                      timestampset.action= $<number>6;                      timestampset.action= $<number>6;
753                      if((timestampset.action == ACTION_EXEC) && command) {                    }
754                        command->events |= EVENT_TIMESTAMP;                  | TIMESTAMP PATH CHANGED action {
755                        addcommand(EXEC);                      timestampset.pathname= $2;
756                      }                      timestampset.test_changes= TRUE;
757                        timestampset.action= $<number>4;
758                    }                    }
759                  ;                  ;
760    
# Line 764  operator        : /* EMPTY */ { $<number Line 763  operator        : /* EMPTY */ { $<number
763                  | LESS        { $<number>$= OPERATOR_LESS; }                  | LESS        { $<number>$= OPERATOR_LESS; }
764                  | EQUAL       { $<number>$= OPERATOR_EQUAL; }                  | EQUAL       { $<number>$= OPERATOR_EQUAL; }
765                  | NOTEQUAL    { $<number>$= OPERATOR_NOTEQUAL; }                  | NOTEQUAL    { $<number>$= OPERATOR_NOTEQUAL; }
766                    | CHANGED     { $<number>$= OPERATOR_NOTEQUAL; }
767                  ;                  ;
768    
769  time            : /* EMPTY */ { $<number>$= TIME_SECOND; }  time            : /* EMPTY */ { $<number>$= TIME_SECOND; }
# Line 1178  static void addresource(struct ResourceS Line 1178  static void addresource(struct ResourceS
1178            
1179    }    }
1180    
1181      if((r->action == ACTION_EXEC) && command) {
1182        r->exec= command;
1183        command= NULL;
1184      }
1185      
1186    current->resourcelist= r;    current->resourcelist= r;
1187    reset_resourceset();    reset_resourceset();
1188    
# Line 1198  static void addtimestamp(struct Timestam Line 1203  static void addtimestamp(struct Timestam
1203    t->operator= ts->operator;    t->operator= ts->operator;
1204    t->time= ts->time;    t->time= ts->time;
1205    t->action= ts->action;    t->action= ts->action;
1206      t->test_changes= ts->test_changes;
1207      
1208      if(!exist_file(t->pathname)) {
1209        
1210        log("%s: The path '%s' used in the TIMESTAMP statement at line %d "
1211            "does not exist\n", prog, t->pathname, lineno-1);
1212        cfg_errflag++;
1213        
1214      } else if(!(t->timestamp= get_timestamp(t->pathname, S_IFDIR|S_IFREG))) {
1215        
1216        log("%s: Cannot get the timestamp for '%s' at line %d -- %s\n",
1217            prog, t->pathname, lineno-1, STRERROR);
1218        cfg_errflag++;
1219        
1220      }
1221      
1222      if((t->action == ACTION_EXEC) && command) {
1223        t->exec= command;
1224        command= NULL;
1225      }
1226    
1227    t->next= current->timestamplist;    t->next= current->timestamplist;
1228    current->timestamplist= t;    current->timestamplist= t;
# Line 1273  static void *addprotocol(int proto) { Line 1298  static void *addprotocol(int proto) {
1298    
1299    
1300  /*  /*
1301   * Add the current command object to the current service object   * Add the current command object to the current service object's
1302     * start or stop program.
1303   */   */
1304  static void addcommand(int what) {  static void addcommand(int what) {
1305    
1306    switch(what) {    switch(what) {
1307    case START: current->start= command; break;    case START: current->start= command; break;
1308    case STOP:  current->stop= command; break;    case STOP:  current->stop= command; break;
   case EXEC:  
       if(current->execlist != NULL) {  
         command->next= current->execlist;  
       }  
       current->execlist= command;  
       break;  
1309    }    }
1310        
1311    command= NULL;    command= NULL;
# Line 1303  static void addargument(char *argument) Line 1323  static void addargument(char *argument)
1323    if(! command) {    if(! command) {
1324            
1325      NEW(command);      NEW(command);
1326        check_exec(argument);
1327        
1328    }    }
1329        
1330    command->arg[command->length++]= argument;    command->arg[command->length++]= argument;
# Line 1835  static void check_depend() { Line 1856  static void check_depend() {
1856  }  }
1857    
1858    
1859    /*
1860     * Check if the executable exist
1861     */
1862    static void check_exec(char *exec) {
1863      
1864      if(! exist_file(exec)) {
1865        log("%s: The executable '%s' at line %d does not exist\n",
1866            prog, exec, lineno);
1867        cfg_errflag++;
1868      }
1869    
1870    }
1871    
1872    
1873  /* -------------------------------------------------------------------- Misc */  /* -------------------------------------------------------------------- Misc */
1874    

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.87

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26