Disable Cron Job Output and Log

Last updated on Jan 2, 2020 in Linux

When the cron job runs, it outputs the result to the standard output (STDOUT) or standard error (STDERR). Especially, if you execute wget command, it creates a new file at every time. You might want to suppress the output of the cron, and this tutorial tells how to do it.

Open Crontab

Open the crontab with your favorite text editor:

$ vim /etc/crontab

Redirect Output and Log to /dev/null

Add /dev/null redirection at the end of the line, as follows:

* * * * * /home/user/myscript.sh >/dev/null 2>&1
  • >/dev/null tells the cron to send all output (STDOUT) to /dev/null, which acts as a “black hole” for useless data
  • 2>&1 tells the cron to send errors (STDERR) to same target than normal output (STDOUT)

After this you won’t see any output or logs after the cron script is executed.