From a1dee657124811fa1c86c750818ff45bcac0b12b Mon Sep 17 00:00:00 2001 From: david Date: Sun, 28 Apr 2013 23:36:22 +0200 Subject: [PATCH] changed to --- sshbackup | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sshbackup b/sshbackup index 6431ed9..895a49e 100755 --- a/sshbackup +++ b/sshbackup @@ -78,13 +78,13 @@ preflight() if [ -z $sourcepath ]; then echo "aborting mission. no source path given." return 1 - elif [ -z $destinationpath ]; then + elif [ -z $destpath ]; then echo "aborting mission. no destination path given." return 1 fi #if remote source or destination check for sshkey - if [[ $sourcepath =~ .*@.* ]] || [[ $destinationpath =~ .*@.* ]]; then + if [[ $sourcepath =~ .*@.* ]] || [[ $destpath =~ .*@.* ]]; then if [ -r $sshkeyfile ]; then #echo "sshkeyfile found. continuing." : @@ -107,31 +107,31 @@ sshbackup() #move existing versions local num=$versions - while [ -d "$destinationpath/0" ]; do - if [ -d "$destinationpath/$num" ]; then - mv $destinationpath/$num $destinationpath/$((num+1)) + while [ -d "$destpath/0" ]; do + if [ -d "$destpath/$num" ]; then + mv $destpath/$num $destpath/$((num+1)) fi let num-- done - #create destinationpath if not existing - mkdir -p $destinationpath/0 + #create destpath if not existing + mkdir -p $destpath/0 #add link-destination option if existing - if [ -d $destinationpath/1 ]; then - cmdopt="$cmdopt --link-dest=$destinationpath/1" + if [ -d $destpath/1 ]; then + cmdopt="$cmdopt --link-dest=$destpath/1" fi #run rsync - $localcmd $cmdopt -e "ssh -q -i $sshkeyfile" --rsync-path="$remotecmd" $sourcepath $destinationpath/0 + $localcmd $cmdopt -e "ssh -q -i $sshkeyfile" --rsync-path="$remotecmd" $sourcepath $destpath/0 if [ $? -ne "0" ]; then return 1 fi #removing obsolet version(s) local i=1 - while [ -d $destinationpath/$((versions+i)) ]; do - rm -rf $destinationpath/$((versions+i)) + while [ -d $destpath/$((versions+i)) ]; do + rm -rf $destpath/$((versions+i)) let i++ done @@ -213,11 +213,11 @@ for option in $options; do sourcepath="$(pwd)/${option%/}/*" fi else - if [ -z "$destinationpath" ]; then + if [ -z "$destpath" ]; then if [[ $option =~ ^/.* ]]; then - destinationpath="${option%/}" + destpath="${option%/}" else - destinationpath="$(pwd)/${option%/}" + destpath="$(pwd)/${option%/}" fi fi fi @@ -244,7 +244,7 @@ if [ -r "$listfile" ]; then : else sourcepath="" - destinationpath="" + destpath="" for option in $line; do if [ -z "${option//[0-9]/}" ]; then versions="$option" @@ -258,11 +258,11 @@ if [ -r "$listfile" ]; then sourcepath="$(pwd)/${option%/}/*" fi else - if [ -z "$destinationpath" ]; then + if [ -z "$destpath" ]; then if [[ $option =~ ^/.* ]]; then - destinationpath="${option%/}" + destpath="${option%/}" else - destinationpath="$(pwd)/${option%/}" + destpath="$(pwd)/${option%/}" fi fi fi