...
 
Commits (3)
#!/usr/bin/env ksh
#!/usr/bin/env bash
#set -x
# Needs a POSIX-compatible sh, like ash (Debian & FreeBSD /bin/sh), ksh, or
# bash. On Solaris 10 you need to use /usr/xpg4/bin/sh (the POSIX shell) or
# /bin/ksh -- its /bin/sh is an ancient Bourne shell, which does not work.
......@@ -63,21 +66,21 @@
# all of the following variables (except CFG) may be set in the config file
DEBUG="" # set to non-null to enable debug (dry-run)
VERBOSE="" # "-v" for verbose, null string for quiet
LOCK="/var/tmp/zfsbackup.lock"
PID="/var/tmp/zfsbackup.pid"
LOCK="/tmp/zfsbackup.lock"
PID="/tmp/zfsbackup.pid"
CFG="/var/lib/zfssnap/zfs-backup.cfg"
ZFS="/usr/sbin/zfs"
ZFS="/sbin/zfs"
# Replace with sudo(8) if pfexec(1) is not available on your OS
PFEXEC=`which pfexec`
PFEXEC=`which sudo`
# local settings -- datasets to back up are now found by property
TAG="zfs-auto-snap_daily"
PROP="edu.tamu:backuptarget"
TAG="zas_daily"
PROP="de.elaon:backuptarget"
# remote settings (on destination host)
REMUSER="zfsbak"
REMUSER="root"
# special case: when $REMHOST=localhost, ssh is bypassed
REMHOST="backupserver.my.domain"
REMPOOL="backuppool"
REMHOST="172.16.1.1"
REMPOOL="storage/backup/jupiter"
REMZFS="$ZFS"
......@@ -202,6 +205,7 @@ do_backup() {
# 'ssh -n' for the actual zfs recv.
newest_remote="$(ssh -n $REMUSER@$REMHOST $REMZFS list -t snapshot -H -S creation -o name -d 1 $TARGET | grep $TAG | head -1)"
err_msg="Error fetching remote snapshot listing via ssh to $REMUSER@$REMHOST."
err_msg="Befehl: zfs send -vR ${DATASET}@${snap2} | ssh ${REMUSER}@${REMHOST} zfs recv -dvF $REMPOOL"
fi
if [ -z $newest_remote ]; then
echo "$err_msg" >&2
......@@ -219,6 +223,7 @@ do_backup() {
echo "Manually run zfs send/recv to bring $TARGET on $REMHOST"
echo "to a snapshot that exists on this host (newest local snapshot with the"
echo "tag $TAG is $snap2)."
echo "Befehl: zfs send -I remote -vR ${DATASET}@${snap2} | ssh ${REMUSER}@${REMHOST} zfs recv -dvF $REMPOOL"
[ $DEBUG ] || touch $LOCK
return 1
fi
......