Skip to content

Instantly share code, notes, and snippets.

@PSJoshi
Created December 2, 2021 06:01
Show Gist options
  • Select an option

  • Save PSJoshi/457cedb7520281cce4d5dd0d6cb5d6fb to your computer and use it in GitHub Desktop.

Select an option

Save PSJoshi/457cedb7520281cce4d5dd0d6cb5d6fb to your computer and use it in GitHub Desktop.
Description of cron script output options

Cron script output options

$ crontab -e
59 23 * * * /home/joshi/bin/backup.sh > /home/joshi/logs/backup.log 2>&1

In the above:

  • /home/joshi/logs/backup.log indicates that the standard output of the backup.sh script will be redirected to the backup.log file.

  • 2>&1 indicates that the standard error (2>) is redirected to the same file descriptor that is pointed by standard output (&1). So, both standard output and error will be redirected to /home/joshi/logs/backup.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment