$ 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