2 # This script is to create a summary of the job notifications from bacula
3 # and send it to people who care.
5 # For it to work, you need to have all Bacula job report
6 # mails cc'd to a unix mailbox called 'bacula', but of course you can edit
7 # as appropriate. This should be run after all backup jobs have finished.
8 # Tested with bacula-1.38.0
10 # Contributed by Andrew J. Millar <andrew@alphajuliet.org.uk>
12 # Use awk to create the report, pass to column to be
13 # formatted nicely, then on to mail to be sent to
15 EMAIL_LIST="peoplewhocare@company.com"
17 print "Client Status Type StartTime EndTime Files Bytes"
20 CLIENT=$2; sub(/"/, "", CLIENT) ; sub(/".*$/, "", CLIENT)
23 TYPE=$2 ; sub(/,.*$/, "", TYPE)
26 STARTTIME=$2; sub(/.*-.*-.* /, "", STARTTIME)
29 ENDTIME=$2; sub(/.*-.*-.* /, "", ENDTIME)
39 sub(/Backup/, "", TERMINATION) ;
40 printf "%s %s %s %s %s %s %s \n", CLIENT,TERMINATION,TYPE,STARTTIME,ENDTIME,SDFILES,SDBYTES}' /var/spool/mail/bacula | \
42 mail -s "Bacula Summary for `date -d yesterday +%a,\ %D`" ${EMAIL_LIST}
45 cat /dev/null > /var/spool/mail/bacula