diff options
author | Micah Anderson <micah@riseup.net> | 2006-11-01 21:50:26 +0000 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2006-11-01 21:50:26 +0000 |
commit | 95ea71bfd169e3e84fdbd53c14ad6152b2895d3f (patch) | |
tree | ef1bf564a109395fc6534fc562dec61b5e421cdc /handlers/rub | |
parent | 0f46b775b9ef027abe15a974395d111a83f29ef3 (diff) | |
download | backupninja-95ea71bfd169e3e84fdbd53c14ad6152b2895d3f.tar.gz backupninja-95ea71bfd169e3e84fdbd53c14ad6152b2895d3f.tar.bz2 |
Added rub handler fixes from rhatto
Diffstat (limited to 'handlers/rub')
-rw-r--r-- | handlers/rub | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/handlers/rub b/handlers/rub index d2b4c44..e05b6fd 100644 --- a/handlers/rub +++ b/handlers/rub @@ -13,7 +13,7 @@ # [general] # log = rsync log file # partition = partition where the backup lives -# fsck = set to 1 if fsck should run on $partition after the backup is made +# fscheck = set to 1 if fsck should run on $partition after the backup is made # read_only = set to 1 if $partition is mounted read-only # mountpoint = backup partition mountpoint or backup main folder # backupdir = folder relative do $mountpoint where the backup should be stored @@ -40,7 +40,7 @@ # initscripts = absolute path where scripts are located # service = script name to be stoped at the begining of the backup and started at its end # -# You can also specify some system comands: +# You can also specify some system comands if you don't want the default system values: # # [system] # rm = rm command @@ -65,7 +65,7 @@ getconf fsck fsck setsection general getconf log /var/log/backupninja-rub.log getconf partition -getconf fsck +getconf fscheck getconf read_only getconf mountpoint getconf backupdir @@ -100,31 +100,29 @@ getconf service function rotate { - # TODO: force to an absolute path - if [[ "$2" < 4 ]]; then error "Rotate: minimum of 4 rotations" exit 1 fi if [ -d $1.$2 ]; then - $nice $mv $1.$2 $1.tmp + $nice $mv /$1.$2 /$1.tmp fi for ((n=`echo "$2 - 1" | bc`; n >= 0; n--)); do if [ -d $1.$n ]; then dest=`echo "$n + 1" | bc` - $nice $mv $1.$n $1.$dest - $touch $1.$dest + $nice $mv /$1.$n /$1.$dest + $touch /$1.$dest fi done if [ -d $1.tmp ]; then - $nice $mv $1.tmp $1.0 + $nice $mv /$1.tmp /$1.0 fi if [ -d $1.1 ]; then - $nice $cp -alf $1.1/. $1.0 + $nice $cp -alf /$1.1/. /$1.0 fi } @@ -257,18 +255,17 @@ if [ "$vservers_are_available" == "yes" ]; then mkdir -p $backupdir/$VROOTDIR chmod 000 $backupdir/$VROOTDIR - for candidate in `ls $VROOTDIR`; do + for candidate in $found_vservers; do + candidate="`basename $candidate`" found_excluded_vserver="0" - if [ "$candidate" != "lost+found" ]; then - for excluded_vserver in $exclude_vserver; do - if [ "$excluded_vserver" == "$candidate" ]; then - found_excluded_vserver="1" - break - fi - done - if [ "$found_excluded_vserver" == "0" ]; then - include="$include $VROOTDIR/$candidate" + for excluded_vserver in $exclude_vserver; do + if [ "$excluded_vserver" == "$candidate" ]; then + found_excluded_vserver="1" + break fi + done + if [ "$found_excluded_vserver" == "0" ]; then + include="$include $VROOTDIR/$candidate" fi done fi @@ -322,7 +319,7 @@ fi # check partition for errors -if [ "$fsck" == "1" ] || [ "$fsck" == "yes" ]; then +if [ "$fscheck" == "1" ] || [ "$fscheck" == "yes" ]; then umount $mountpoint if (($?)); then warning "Could not umount $mountpoint to run fsck" |