From: Alan J. Pippin Date: Fri, 16 Jan 2009 15:10:07 +0000 (-0700) Subject: Added replicate wrapper logfile. X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/.%24link.?a=commitdiff_plain;h=9a12c36d03babea71bd13dc208a64ff91f61b699;p=zfs-nexenta%2F.git Added replicate wrapper logfile. Added concept of "no limit" maxruntime. --- diff --git a/zfs-replicate-wrapper b/zfs-replicate-wrapper index d699c79..a43e8fb 100755 --- a/zfs-replicate-wrapper +++ b/zfs-replicate-wrapper @@ -6,8 +6,10 @@ # Setup some default values zfsreplicate="/etc/bin/zfs-replicate" +logdir="/var/log/zfs" logfile_parser="/etc/bin/zfs-log-parser" -logfile="/var/log/zfs/zfs-replicate.log" +logfile="$logdir/zfs-replicate.log" +mylogfile="$logdir/zfs-replicate-all.log" remote="tank.pippins.net" local_pool=backups mailto=root@pippins.net @@ -21,11 +23,14 @@ naspool/www naspool/git ' -# Specify the maximum run time in minutes that this script can run +# 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() { + if [[ $maxruntime == 0 ]]; then + return 0 + fi currenttime=`date +%s` elapsedtime=$(($currenttime - $starttime)) stoptime=$(($maxruntime*60)) @@ -86,6 +91,7 @@ previous_backup_marker=@previous-backup-${local_pool_guid} # Auto snapshot every zfs filesystem on the system specified below echo "$date ZFS replicate started" >> $logfile +echo "$date ZFS replicate started" | tee -a $mylogfile # Sort the filesystems to replicate by the oldest backup first tmpfile=`tempfile` @@ -98,13 +104,15 @@ rm -f $tmpfile # Replicate the sorted filesystems for filesystem in $sorted_filesystems; do - echo "-> Replicating $remote:$filesystem to ${local_pool}/${filesystem}" + echo "-> Replicating $remote:$filesystem to ${local_pool}/${filesystem}" | tee -a $mylogfile replicate $remote $filesystem done # All done 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