/[monit]/monit/file.c
ViewVC logotype

Diff of /monit/file.c

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

revision 1.1 by hauk, Sun Dec 12 23:45:08 2004 UTC revision 1.2 by martinp, Tue Jan 4 13:59:54 2005 UTC
# Line 141  time_t File_getTimestamp(char *object, m Line 141  time_t File_getTimestamp(char *object, m
141    
142  /**  /**
143   * Search the system for the monit control file. Try first ~/.monitrc,   * Search the system for the monit control file. Try first ~/.monitrc,
144   * if that fails try /etc/monitrc and finally ./monitrc.  Exit the   * if that fails try /etc/monitrc, then /usr/local/etc/monitrc and
145   * application if the control file is not found.   * finally ./monitrc.  Exit the application if the control file was
146     * not found.
147   * @return The location of monits control file (monitrc)   * @return The location of monits control file (monitrc)
148   */   */
149  char *File_findControlFile() {  char *File_findControlFile() {
# Line 158  char *File_findControlFile() { Line 159  char *File_findControlFile() {
159    if(File_exist(rcfile)) {    if(File_exist(rcfile)) {
160      return (rcfile);      return (rcfile);
161    }    }
162      memset(rcfile, 0, STRLEN);
163      snprintf(rcfile, STRLEN, "/usr/local/etc/%s", MONITRC);
164      if(File_exist(rcfile)) {
165        return (rcfile);
166      }
167    if(File_exist(MONITRC)) {    if(File_exist(MONITRC)) {
168      memset(rcfile, 0, STRLEN);      memset(rcfile, 0, STRLEN);
169      snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC);      snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC);
170      return (rcfile);      return (rcfile);
171    }    }
172    log("%s: Cannot find the control file at ~/.%s, /etc/%s or at ./%s \n",    log("%s: Cannot find the control file at "
173        prog, MONITRC, MONITRC, MONITRC);        "~/.%s, /etc/%s, /usr/local/etc/%s or at ./%s \n",
174          prog, MONITRC, MONITRC, MONITRC, MONITRC);
175    exit(1);    exit(1);
176        
177  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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