← Back to team overview

nssbackup-team team mailing list archive

Re: [Question #234488]: lauching a task before backup

 

Question #234488 on sbackup changed:
https://answers.launchpad.net/sbackup/+question/234488

Anton posted a new comment:
/usr/share/sbackup/retry_backup:

#!/bin/bash
#
# retry running Sbackup if previous attempt failed
# used by pm to run at thaw/resume

# find config file and read some variables
my_dir=`dirname $0`
if [ -x $my_dir/get_conf ]; then
    . $my_dir/get_conf
else # get from default location
    . /usr/share/sbackup/get_conf
fi

# find backup schedule and check with latest succesful backup:
if [ -x /usr/share/sbackup/check_backup_schedule ]; then
    /usr/share/sbackup/check_backup_schedule
    if (( $? != 1 )); then
	# no backup needed
	exit 0
    fi
fi

# check ping to backup host
# strip username, if needed:
buhost=`echo $buhost | sed 's/^.*@//'`
echo "Checking ping average round-trip time (rtt) to $buhost"
# get average ping time in micro seconds (so it can be integer, not real):
ping=`ping -c 10 $buhost | tail -1 | awk -F= '{print $2}' | awk -F/ '{print $2*1000}'`
ping_max=1000
if [ $ping -gt $ping_max ]; then 
    echo "Rtt is too slow ($ping; max $ping_max), not making backup now!"
    exit 0
fi

for sbackup in /usr/share/sbackup/sbackup-launch /usr/bin/sbackup /usr/sbin/sbackupd; do
    if [ -x $sbackup ]; then
	echo "Launching $sbackup"
	$sbackup
	exit 0
    fi
done

#last line

-- 
You received this question notification because you are a member of
Simple Backup Maintainers, which is an answer contact for sbackup.