12345678910111213141516171819202122232425262728 |
- #!/bin/bash
- # A little script to generate a monthly report about storeBackup backups
- # written by Helmut Pozimski <helmut@pozimski.eu> in 2013
- # Define the hosts to be checked
- hosts=""
- backupdir=""
- tmpfile="/tmp/backup_report.mail"
- mailto="root"
- sender="backup-report@$(hostname -f)"
- for host in $hosts; do
- echo "*Backups for host $host:*" >> $tmpfile
- printf "\n" >> $tmpfile
- echo "Correctly finished backups:" >> $tmpfile
- printf "\n" >> $tmpfile
- storeBackupls.pl $backupdir/$host/default 2>&1 | grep -v unresolved >> $tmpfile
- printf "\n" >> $tmpfile
- echo "Failed or not yet linked backups:" >> $tmpfile
- printf "\n" >> $tmpfile
- storeBackupls.pl $backupdir/$host/default 2>&1 | grep unresolved >> $tmpfile
- printf "\n" >> $tmpfile
- done
- mailx -r $sender -s "Backup-Report for $(LANG=C date +%B) $(date +%Y)" $mailto < $tmpfile
- rm $tmpfile
|