ok.. more changes:
First; with reference to my last post. If you change the Backuplist filename to be prefixed with the week number AND Zimbra_ the routine that automates file move from current to old directories works on all files, not just the .dar and .md5 files. e.g. 36_Zimbra_Backuplist_13-September-2008.txt.gz.
Second; to enable daily log files to be sent. Find the following line in the FULL section of the script (modified as per recent posting to prevent the permissions error from occurring and the file renaming above):
Code:
(cat $LOG; $UUENCODE_BIN "$ARCHIVEDIR""$BACKUPWEEK"_Zimbra_Backuplist_"$BACKUPDATE".txt.gz "$ARCHIVEDIR""$BACKUPWEEK"_Zimbra_Backuplist_"$BACKUPDATE".txt.gz) | mail -c $EMAILCC \
-s "Zimbra Diff Backup Log on `hostname --fqdn`" $EMAIL Notice that you found this line immediately below the section that concludes the script by telling you how long the run-time was? .. paste this line below the exact same point in the DIFF section (scroll right to the bottom), e.g:
Code:
# Script Timer
STOPTIME=(`date +%s`)
RUNTIME=$(expr $STOPTIME - $STARTTIME)
echo
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
echo "Diff Zimbra Backup ended at: `date +%H:%M`"
echo "Backup took $(date -d "1970-01-01 $RUNTIME sec" +%H:%M:%S) to complete"
echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
(cat $LOG; $UUENCODE_BIN "$ARCHIVEDIR""$BACKUPWEEK"_Zimbra_Backuplist_"$BACKUPDATE".txt.gz "$ARCHIVEDIR""$BACKUPWEEK"_Zimbra_Backuplist_"$BACKUPDATE".txt.gz) | mail -c $EMAILCC \
-s "Zimbra Diff Backup Log on `hostname --fqdn`" $EMAIL
echo Don't forget to insert the UUENCODE= lines (as per another recent posting) into the DIFF section to prevent the "901" error.
Now.. AS ROOT, modify root's crontab (crontab -e) and edit the second line that schedules DIFF backups and log rotation so that after the -d there is only one > instead of >>:
Code:
30 1 * * 1 /bin/bash /opt/zmbac.sh -f > /var/log/zim_backup.log 2>&1
30 1 * * 2-7 /bin/bash /opt/zmbac.sh -d > /var/log/zim_backup.log 2>&1
Save the crontab. You should now receive the log file daily, and the log file should contain only that days output. If you omit the crontab change you generate a single log file each week with each daily run appending itself to the bottom of the report. Personally I prefer to have a new logfile each day so there is less to scroll past to see that the script ran okay (albeit you get more emails to read).
Christian