Ubuntu – How to add the logs to a crontab with time stamp

bashcronlogsscripts

In crontab, I scheduled a daily backup script. Now when the cron executes the script the status are logged to a log file as shown below.

0 0 * * * /home/backup.sh > /home/groupz/db-backup/fbackup.log 2>&1  

Now, when the cron executes a script the contents of the log get renewed everytime. So, I want the contents to be added to the same file with time stamp of the executed time and below the contents of each time along with the existing contents. How can I do this.

Best Answer

why not just

0 * * * * (/bin/date && /home/backup.sh) >> /var/log/backup.log 2>&1

Related Question