Added configuration scripts to hold customized options
[zfs-nexenta/.git] / zfs-replicate-wrapper
index a43e8fb75204542978af8ca62bdf00e0d679e36e..c6c3369e5eec98211424805191b6091bc18f2a42 100755 (executable)
@@ -4,27 +4,16 @@
 # Description: This script calls zfs-replicate for each filesystem needing
 #              to be backed up, or replicated, to another ZFS pool.
 
+# source our configuration 
+config="${0%/*}/zfs-scripts.conf"
+[ -e "${config}.dist" ] && . ${config}.dist
+[ -e "${config}" ] && . ${config}
+
 # Setup some default values
-zfsreplicate="/etc/bin/zfs-replicate"
-logdir="/var/log/zfs"
-logfile_parser="/etc/bin/zfs-log-parser"
 logfile="$logdir/zfs-replicate.log"
 mylogfile="$logdir/zfs-replicate-all.log"
-remote="tank.pippins.net"
-local_pool=backups
-mailto=root@pippins.net
 date=`date`
 starttime=`date +%s`
-zfs=/usr/sbin/zfs
-
-# Specify the list of filesystems to replicate
-filesystems_to_replicate='
-naspool/www
-naspool/git
-'
-
-# Specify the maximum run time in minutes that this script can run (0=no limit)
-maxruntime=240
 
 # This function checks to see if our runtime has exceeded our stoptime
 timeexceeded() { 
@@ -52,7 +41,7 @@ trap cleanup_and_exit INT
 
 # This function executes the replicate command and checks the stoptime
 replicate() { 
-  $zfsreplicate $*  >> $logfile 2>&1
+  zfs-replicate $*  >> $logfile 2>&1
   timeexceeded
   if [ $? == 1 ]; then
     cleanup_and_exit
@@ -113,6 +102,6 @@ echo `date` ZFS replicate complete >> $logfile
 echo `data` ZFS replicate complete | tee -a $mylogfile
 
 # Parse the log file and extract our backup stats
-$logfile_parser "$logfile" "$date" >> $logfile
-$logfile_parser "$logfile" "$date" | tee -a $mylogfile
+zfs-log-parser "$logfile" "$date" >> $logfile
+zfs-log-parser "$logfile" "$date" | tee -a $mylogfile