0

Ubuntu 16.04 does not seem to understand the special case of the dash (hyphen) character as first character of a crontab entry. Putting "-" as the first character of a crontab entry prevents cron from writing a syslog message about the cron command being executed on some Linux distros, such as SuSE:

crontab: question about a special case of the dash character in the time field spec

If I run crontab -e and attempt to insert "-" as the first character in a crontab entry, I get:

crontab: installing new crontab
"/tmp/crontab.2Hf5FN/crontab":25: bad minute
errors in crontab file, can't install.

Ubuntu's "man 5 crontab" is silent about this special case.

Can anyone offer insight on how to tell cron that I do not want it to report instances of execution of a particular line in my crontab file?

5
  • Have you tried running crontab as root or with sudo crontab -e command? It says in the article that you can put "-", If the uid of the owner is 0 (root)
    – user633551
    Mar 27, 2017 at 19:04
  • Yes. I get the same error message, "bad minute", when I try installing a new root crontab with "sudo crontab -e".
    – Beef Eater
    Mar 27, 2017 at 20:27
  • What you could also try is to modify /etc/rsyslog.d/50-default.conf file. Change following line *.*;auth,authpriv.none -/var/log/syslog to *.*;cron,auth,authpriv.none -/var/log/syslog. And use crontab normally without "-"
    – user633551
    Mar 28, 2017 at 21:45
  • Right. But that disables all crontab entries from reporting into syslog. In my case, I am looking for a way to prevent just one particular entry in crontab from reporting to syslog about its execution. The crontab task runs every two minutes and performs trivial tasks. By making unwanted entries in syslog every two minutes, this crontab task pollutes syslog.
    – Beef Eater
    Mar 30, 2017 at 2:13
  • Hmm, I haven't tried this yet but seems like you would have to create a filter.conf file with your own specific rule and stop it from reporting to syslog. Might want to read this.... unix.stackexchange.com/questions/100722/…
    – user633551
    Mar 30, 2017 at 15:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.