backup_report.sh 851 B

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