Read excludes from /backup directory
[wizbackup.git] / wizbackup-driver
index 10090c90482ce3a5970e41a6c730971dd217e26c..1709284a3e8469869acae708f07709d0e41bba2a 100755 (executable)
@@ -1,12 +1,21 @@
 #!/bin/bash
 #
 # WizBackup Driver 1.0
-# Copyleft 2011 Bernie Innocenti <bernie@codewiz.org>
+# Copyright 2011 Bernie Innocenti <bernie@codewiz.org>
+#
+#  This program is free software: you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation, either version 3 of the License,
+#  or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License,
-# or (at your option) any later version.
 
 if [ $# -lt 1 ]
 then
@@ -22,15 +31,15 @@ HOSTS=`cat $1 | egrep -v '^#|^ *$'`
 LOGGROUP=`basename $1`
 LOGDIR=/var/log/wizbackup
 LOCKDIR=/var/lock/wizbackup
-EXCLUDES_DIR=/root/rsync-backups/exclude
 DEST=/backup
+EXCLUDES_DIR=$DEST/EXCLUDE
 
 today=`date +"%Y%m%d"`
 mkdir -p $LOGDIR
 mkdir -p $LOCKDIR
 
 if [ "`tty`" = "not a tty" ]; then
-       OUTLOGFILE="$LOGDIR/$LOGGROUP-$today.log"
+       LOGFILE="$LOGDIR/$LOGGROUP-$today.log"
 else
        LOGFILE=/dev/stdout
 fi
@@ -46,7 +55,7 @@ for host in $HOSTS; do
        result=$?
        end_time=$(date +%s)
 
-       report="$(date):$host:$(($end_time-$start_time)):$result"
+       report="$(date +%s):$host:$(($end_time-$start_time)):$result"
        echo $report >>$LOGDIR/$LOGGROUP-report-$today.log
        [ $result != 0 ] && echo "$report" >>$LOGDIR/$LOGGROUP-fail-$today.log
 done