]> git.ipfire.org Git - thirdparty/fcron.git/commitdiff
added option nolog
authorThibault Godouet <yo8192@users.noreply.github.com>
Thu, 1 Feb 2001 20:49:31 +0000 (20:49 +0000)
committerThibault Godouet <yo8192@users.noreply.github.com>
Thu, 1 Feb 2001 20:49:31 +0000 (20:49 +0000)
fileconf.c
job.c
option.h

index ae3066c9ecbe2b0676b21d77cd18f96f51a50aef..d7853a6ab52b794ff08b247ab612600784e43d25 100644 (file)
@@ -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 7b6228fd008533d5d60705112da852813ee936fa..b47e2d4f26593e35969a430ea677957465148fc4 100644 (file)
--- 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",
index c53faa7ef9f95a7e7f955a0276ed638f7d215796..b62279fb07854b606eb96c214c8e0304feba14a7 100644 (file)
--- 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 ?
 
 */
 
        (_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__ */