View Single Post
  #162 (permalink)  
Old 10-08-2009, 09:17 PM
chewitt chewitt is offline
Active Member
 
Posts: 30
Default

More tweaks..

I have the script send an email each night, and now that I fixed the uuencode problem by installing sharutils I was receiving a 1MB+ file listing attachment each morning. I never read these, and I could do without an extra 370MB of data being added to my mail server each year (admin mail is rarely deleted, bad but fact).

The following tweak adds an option to enable/disable the attachment of the XX_Zimbra_Backup_DD-Month-Year.LIST.txt.gz files. Please note that the filenames in the snippets have been changed as per my last post.

First, add an option in the config area of the script:

Code:
#--- Log Settings ---#
EMAIL="xxxxx@xxx.xxxxxxx.xxx"	# the address to send logs to
EMAILCC="xxx@xxxxx.xxx"		# another address to send to
LOG="/opt/zimbra_backup.log"	# log location
ATTACHLIST="no"			# attach backup file or not?
Then head to the section that generates the email (around line 770):

Code:
# Script Timer
    STOPTIME=(`date +%s`)
    RUNTIME=$(expr $STOPTIME - $STARTTIME)
    echo
    echo "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" 
    echo "Zimbra $TYPE backup ended at: `date +%H:%M`" 
    echo "Backup took $(date -d "1970-01-01 $RUNTIME sec" +%H:%M:%S) to complete" 
    echo "::::::::::::::::::::: cheers Osoffice for the script :::::::::::::::::"
	if [ "$ATTACHLIST" = "yes" ]
	then
	    (cat $LOG; $UUENCODE_BIN "$ARCHIVEDIR""$BACKUPWEEK"_"$BACKUPNAME"_"$BACKUPDATE"_LIST.txt.gz "$ARCHIVEDIR""$BACKUPWEEK"_"$BACKUPNAME"_"$BACKUPDATE"_LIST.txt.gz) \
    | mail -c $EMAILCC -s "Zimbra $TYPE Backup Log on $HOSTNAME" $EMAIL
	else
	    cat $LOG | mail -c $EMAILCC -s "Zimbra $TYPE Backup Log on $HOSTNAME" $EMAIL
	fi
	
}
Christian
Reply With Quote