!/bin/bash
script to check all of the backups at DOMAIN and send the results in an email
2009-07 johnpfeiffer, updated 2010-06-29 - absolute paths to files is better...
the -e allows interpretation of backslashes, \n means newline, > overwrites the last /trac-root/tracScripts/email-backup.txt file
echo " " > /trac-root/tracScripts/email-backup.txt
echo "APC UPS temperature monitor = xx.x degrees celsius" >> /trac-root/tracScripts/email-backup.txt snmpget -v1 -c public 192.168.1.10 enterprises.318.1.1.1.2.3.2.0 >> /trac-root/tracScripts/email-backup.txt
check the acronis images and system state jobs on the external hard drive, append the top 20 lines to email-backup.txt
awk then only shows columns 5,6,7 and 8 and then it overwrites the last email-backup.txt file
if [ ! -d /mnt/servername/madics ]; then umount /mnt/servername mount -t cifs //192.168.1.35/external /mnt/servername -o username=DOMAIN/USERNAME,password=PASSWORD fi
ls -tahl /mnt/servername/ | head -n 20 | awk '{print $5,$6,$7,$8,$9}' >> /trac-root/tracScripts/email-backup.txt
echo -e "\n------------------------------------------------------------------------------\n" >> /trac-root/tracScripts/email-backup.txt
check the linux bacukps sorted by time, show all hidden and attributes (head only shows the top items)
ls -tahl /mnt/servername/linux-backups/ | head | awk '{print $5,$6,$7,$8,$9}' >> /trac-root/tracScripts/email-backup.txt
echo -e "\n------------------------------------------------------------------------------\n" >> /trac-root/tracScripts/email-backup.txt
check the madics bacukps sorted by time, show all hidden and attributes (head only shows the top items)
ls -tahl /mnt/servername/madics/ | head | awk '{print $5,$6,$7,$8,$9}' >> /trac-root/tracScripts/email-backup.txt
check if the madics backup is valid or if there's an EOF tar error, should end with "madics/temp"
tail -n 5 /mnt/servername/madics//bin/date +%Y-%m-%d
-madics-backup-VERIFY.txt >> /trac-root/tracScripts/email-backup.txt
echo -e "\n------------------------------------------------------------------------------\n" >> /trac-root/tracScripts/email-backup.txt
check the sql server native backup to the \external\sqlback folder
ls -tahl /mnt/servername/sqlback/server_MSCRM | awk '{print $5,$6,$7,$8,$9}' >> /trac-root/tracScripts/email-backup.txt ls -tahl /mnt/servername/sqlback/WSS_Cont_80 | awk '{print $5,$6,$7,$8,$9}' >> /trac-root/tracScripts/email-backup.txt
echo -e "\n------------------------------------------------------------------------------\n" >> /trac-root/tracScripts/email-backup.txt
replace the single spaces with tabs and write to a new file
sed -e 's/ /\t /g' /trac-root/tracScripts/email-backup.txt > /trac-root/tracScripts/email-backup-tabs.txt
add the information about the brightstor backup - temporarily mount the shared folder
mount -t smbfs -o username=USERNAME,password=PASSWORD //SERVER/ARCserve$ /mnt/brightstor tail -n 30 /mnt/brightstor/LOG/BrightStor.log > /trac-root/tracScripts/email-backup.txt umount /mnt/brightstor
clean up the brightstor log text - very odd workaround
sed -e 's/\r/\n\r/' /trac-root/tracScripts/email-backup.txt >> /trac-root/tracScripts/email-backup-tabs.txt
mail -s daily-backup support@DOMAIN.co.uk < /trac-root/tracScripts/email-backup-tabs.txt