From: Thibault Godouet Date: Thu, 1 Feb 2001 20:49:31 +0000 (+0000) Subject: added option nolog X-Git-Tag: ver2_9_4~420 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b38e7dde8b163b426a60564420a97eb88e13280;p=thirdparty%2Ffcron.git added option nolog --- diff --git a/fileconf.c b/fileconf.c index ae3066c..d7853a6 100644 --- a/fileconf.c +++ b/fileconf.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: fileconf.c,v 1.37 2001-01-30 17:41:35 thib Exp $ */ + /* $Id: fileconf.c,v 1.38 2001-02-01 20:49:31 thib Exp $ */ #include "fcrontab.h" @@ -830,6 +830,17 @@ read_opt(char *ptr, CL *cl) fprintf(stderr, " Opt : \"%s\" %d\n", opt_name, i); } + else if( strcmp(opt_name, "nolog") == 0 ) { + if ( in_brackets && (ptr = get_bool(ptr, &i)) == NULL ) + Handle_err; + if ( i == 0 ) + clear_nolog(cl->cl_option); + else + set_nolog(cl->cl_option); + if (debug_opt) + fprintf(stderr, " Opt : \"%s\" %d\n", opt_name, i); + } + else if(strcmp(opt_name, "n") == 0 || strcmp(opt_name, "nice") == 0) { if( ! in_brackets || (ptr = get_nice(ptr, &i)) == NULL ) Handle_err; diff --git a/job.c b/job.c index 7b6228f..b47e2d4 100644 --- a/job.c +++ b/job.c @@ -22,7 +22,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: job.c,v 1.32 2001-01-30 17:42:27 thib Exp $ */ + /* $Id: job.c,v 1.33 2001-02-01 20:52:06 thib Exp $ */ #include "fcron.h" @@ -255,7 +255,8 @@ run_job(struct exe *exeent) exeent->e_pid = pid; line->cl_file->cf_running += 1; - explain("Job %s started (pid %d)", line->cl_shell, pid); + if ( ! is_nolog(line->cl_option) ) + explain("Job %s started (pid %d)", line->cl_shell, pid); } @@ -284,7 +285,7 @@ end_job(CL *line, int status, int mailfd, short mailpos) debug("Job %s terminated%s", line->cl_shell, m); } else if (WIFEXITED(status)) - explain("Job %s terminated (exit status: %d)%s", + warn("Job %s terminated (exit status: %d)%s", line->cl_shell, WEXITSTATUS(status), m); else if (WIFSIGNALED(status)) error("Job %s terminated due to signal %d%s", diff --git a/option.h b/option.h index c53faa7..b62279f 100644 --- a/option.h +++ b/option.h @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: option.h,v 1.15 2001-01-27 15:45:08 thib Exp $ */ + /* $Id: option.h,v 1.16 2001-02-01 20:53:11 thib Exp $ */ /* This has been inspired from bitstring(3) : here is the original copyright : */ @@ -77,6 +77,7 @@ 19 Freq (ie daily) is from middle to middle of interval (ie nightly) ? 20 Should we remove a %-job from lavg queue if the interval is exceeded ? 21 Should user be mailed if a %-job has not run during a period ? + 22 Should fcron log everything about this job or just errors ? */ @@ -401,5 +402,17 @@ (_bit_clear(opt, 21)) +/* + bit 22 : set to 1 : do not log normal activity of this job (only errors) + set to 0 : log everything +*/ +#define is_nolog(opt) \ + (_bit_test(opt, 22)) +#define set_nolog(opt) \ + (_bit_set(opt, 22)) +#define clear_nolog(opt) \ + (_bit_clear(opt, 22)) + + #endif /* __OPTIONH__ */