--- miscutils/crond.c +++ miscutils/crond.c @@ -35,6 +35,14 @@ //config: help //config: Command output will be sent to corresponding user via email. //config: +//config:config FEATURE_CROND_ROOT_NOLOG +//config: bool "Suppress logging of start information for a job (root user only)" +//config: default y +//config: depends on CROND +//config: help +//config: A dash character (-) at the first position of the minute field of +//config: an entry prevents crond from logging every start of that job. +//config: //config:config FEATURE_CROND_DIR //config: string "crond spool directory" //config: default "/var/spool/cron" @@ -105,6 +113,9 @@ int cl_empty_mail_size; /* size of mail header only, 0 if no mailfile */ char *cl_mailto; /* whom to mail results, may be NULL */ #endif +#if ENABLE_FEATURE_CROND_ROOT_NOLOG + smallint cl_nolog; /* bool: disable logging of start message for job entries starting with a dash (-), only valid for user 'root' */ +#endif char *cl_shell; /* ordered by size, not in natural order. makes code smaller: */ char cl_Dow[7]; /* 0-6, beginning sunday */ @@ -469,6 +480,13 @@ if (n < 6) continue; *pline = line = xzalloc(sizeof(*line)); +#if ENABLE_FEATURE_CROND_ROOT_NOLOG + line->cl_nolog = 0; + if (strcmp(fileName, "root") == 0 && *(tokens[0]) == '-') { + line->cl_nolog = 1; + (tokens[0])++; + } +#endif /* parse date ranges */ ParseField(file->cf_username, line->cl_Mins, 60, 0, NULL, tokens[0]); ParseField(file->cf_username, line->cl_Hrs, 24, 0, NULL, tokens[1]); @@ -851,6 +869,9 @@ start_one_job(file->cf_username, line); pid = line->cl_pid; +#if ENABLE_FEATURE_CROND_ROOT_NOLOG + if (!line->cl_nolog) +#endif log8("USER %s pid %3d cmd %s", file->cf_username, (int)pid, line->cl_cmd); if (pid < 0) {