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 # loggin to file, edit path for Your needs
7 # This should be run after all backup jobs have finished.
8 # Tested with bacula-1.38.0
10 # Some improvements by: Andrey Yakovlev <freedom@kiev.farlep.net> (ISP Farlep)
11 # Contributed by Andrew J. Millar <andrew@alphajuliet.org.uk>
12 # Patched by Andrey A. Yakovlev <freedom@kiev.farlep.net>
14 # Use awk to create the report, pass to column to be
15 # formatted nicely, then on to mail to be sent to
18 EMAIL_LIST="freedom@kiev.farlep.net"
20 LOG='/var/db/bacula/log'
23 #---------------------------------------------------------------------
26 print "Client Status Type StartTime EndTime Files Bytes"
29 /orion-dir: New file:/ {
38 CLIENT=$2; sub(/"/, "", CLIENT) ; sub(/".*$/, "", CLIENT)
41 TYPE=$2 ; sub(/,.*$/, "", TYPE)
44 STARTTIME=$2; sub(/.*-.*-.* /, "", STARTTIME)
47 ENDTIME=$2; sub(/.*-.*-.* /, "", ENDTIME)
61 sub(/Backup/, "", TERMINATION) ;
62 gsub(/\*\*\*/, "", TERMINATION) ;
63 sub(/Verify OK/, "OK-Verify", TERMINATION) ;
64 sub(/y[ ]/, "y-", TERMINATION) ;
65 printf "%s %s %s %s %s %s %s \n", CLIENT,TERMINATION,TYPE,STARTTIME,ENDTIME,SDFILES,SDBYTES}' ${LOG} | \
67 mail -s "Bacula Summary for `date -v -1d +'%a, %F'`" ${EMAIL_LIST}
70 cat ${LOG} > ${LOG}.old
71 cat /dev/null > ${LOG}