I was wondering if it is possible to having multiple cron jobs in crontab active, but only one of them starts each minute. The problem here is I wish to keep log of all others jobs informations with the exception of this only one.

Oct 25 14:50:01 dtest CRON[942]: (root) CMD (/usr/bin/python2.7 check.py > /dev/null 2>&1)

Currently I am getting flooded with all those lines, which made me curious if cron is able to supress a log entry for selected processes?

  • I don't think cron is designed to be configured to not log event triggers for only one specific event. You can either log, or not. If you want to tail the log and eschew those entries, you can tail -f logfile | grep -v 'python2\.7 check\.py'. – DopeGhoti Oct 25 '18 at 19:05
  • 1
    Just was curious if there is actually any possibility to hide specific entry. Thank You for clarification – RedS Oct 25 '18 at 19:15
  • How are you being flooded? Email? Syslog? Something else? – roaima Oct 25 '18 at 19:54

On distros using cronie (e.g. CentOS, RHEL, openSUSE, Fedora, Gentoo, Arch etc), you can just use the special "-" entry in the first column of crontab.

Note that this doesn't help your situation, as you're on Debian, which uses Vixie cron

Example usage, on CentOS, below. See how the job to touch /tmp/foo2 did get run at 19:37 but did not record the run in /var/log/cron.

# crontab -l
* * * * * touch /tmp/foo1
-* * * * * touch /tmp/foo2
# ls -l /tmp/foo*
-rw-r--r--. 1 root root 0 Oct 25 19:37 /tmp/foo1
-rw-r--r--. 1 root root 0 Oct 25 19:37 /tmp/foo2
# grep foo /var/log/cron
Oct 25 19:37:01 instance-2 CROND[12639]: (root) CMD (touch /tmp/foo1)

I'm not sure where this is fully documented, but the code establishing this behaviour can be seen in cronie source code

/* check for '-' as a first character, this option will disable 
* writing a syslog message about command getting executed
if (ch == '-') {
/* if we are editing system crontab or user uid is 0 (root) 
* we are allowed to disable logging 
    if (pw == NULL || pw->pw_uid == 0)
        e->flags |= DONT_LOG;
    else {
        log_it("CRON", getpid(), "ERROR", "Only privileged user can disable logging", 0);
        ecode = e_option;
        goto eof;
    ch = get_char(file);
    if (ch == EOF) {
        return NULL;

Which is then referenced elsewhere in the cronie source code

if ((e->flags & DONT_LOG) == 0) {
    char *x = mkprints((u_char *) e->cmd, strlen(e->cmd));
    log_it(usernm, getpid(), "CMD", x, 0);
  • 1
    The source code you referred is of "cronie", not "cron". The latter produces an error message: "bad minute". – nst0022 Oct 26 '18 at 0:49
  • 1
    @nst0022 - Yes, on reflection, Debian uses Vixie cron, which lacks this functionality. Note added to answer. Have left it present in case helps any non-Debian users when faced with this challenge. – steve Oct 26 '18 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.