]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/examples/reports/bacula_mail_summary.sh
kes Fix optional files in Makefile.in of src/filed that caused
[bacula/bacula] / bacula / examples / reports / bacula_mail_summary.sh
index 266bfd1e5a34261f72a802cc59a0f3f0c01b4fd5..901f2efc9333b188fa9ba5d22414c1b2d958a483 100755 (executable)
@@ -3,19 +3,37 @@
 # and send it to people who care.
 #
 # For it to work, you need to have all Bacula job report
-# mails cc'd to a unix mailbox called 'bacula', but of course you can edit
-# as appropriate. This should be run after all backup jobs have finished.
+# loggin to file, edit path for Your needs
+# This should be run after all backup jobs have finished.
 # Tested with bacula-1.38.0
 
+# Some improvements by: Andrey Yakovlev <freedom@kiev.farlep.net>  (ISP Farlep)
 # Contributed by Andrew J. Millar <andrew@alphajuliet.org.uk>
+# Patched by Andrey A. Yakovlev <freedom@kiev.farlep.net>
 
 # Use awk to create the report, pass to column to be
 # formatted nicely, then on to mail to be sent to
 # people who care.
-EMAIL_LIST="peoplewhocare@company.com"
+
+EMAIL_LIST="freedom@kiev.farlep.net"
+
+LOG='/var/db/bacula/log'
+
+
+#---------------------------------------------------------------------
+
 awk -F\:\  'BEGIN {
                         print "Client Status Type StartTime EndTime Files Bytes"
                 }
+                
+        /orion-dir: New file:/ {
+                print $3
+        }
+        
+        /orion-dir: File:/ {
+                print $3
+        }
+                
         /Client/ {
                 CLIENT=$2; sub(/"/, "", CLIENT) ; sub(/".*$/, "", CLIENT)
         }
@@ -28,20 +46,28 @@ awk -F\:\  'BEGIN {
         /End time/ {
                 ENDTIME=$2; sub(/.*-.*-.* /, "", ENDTIME)
         }
+        /Files Examined/ {
+                SDFILES=$2
+                SDBYTES=0
+        }
         /SD Files Written/ {
                 SDFILES=$2
         }
-         /SD Bytes Written/ {
+        /SD Bytes Written/ {
                 SDBYTES=$2
         }
         /Termination/ {
                 TERMINATION=$2 ;
                 sub(/Backup/, "", TERMINATION) ;
-                printf "%s %s %s %s %s %s %s \n", CLIENT,TERMINATION,TYPE,STARTTIME,ENDTIME,SDFILES,SDBYTES}' /var/spool/mail/bacula | \
-        column -t | \
-        mail -s "Bacula Summary for `date -d yesterday +%a,\ %D`" ${EMAIL_LIST}
+                gsub(/\*\*\*/, "", TERMINATION) ;
+                sub(/Verify OK/, "OK-Verify", TERMINATION) ;
+                sub(/y[ ]/, "y-", TERMINATION) ;
+                printf "%s %s %s %s %s %s %s \n", CLIENT,TERMINATION,TYPE,STARTTIME,ENDTIME,SDFILES,SDBYTES}' ${LOG} | \
+        column -t -x | \
+        mail -s "Bacula Summary for `date -v -1d  +'%a, %F'`" ${EMAIL_LIST}
 #
-# Empty the mailbox
-cat /dev/null > /var/spool/mail/bacula
+# Empty the LOG
+cat ${LOG} > ${LOG}.old
+cat /dev/null > ${LOG}
 #
 # That's all folks