Changeset 360


Ignore:
Timestamp:
11/26/08 18:45:57 (3 years ago)
Author:
tschmitt
Message:

linuxmuster-backup:

  • minor improvements in handling incremental and differential backupsets
  • backup device will be temporarily removed from fstab during backup
Location:
main/linuxmuster-base/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/linuxmuster-base/trunk/debian/changelog

    r357 r360  
     1linuxmuster-base (1.4.43-1) testing; urgency=low 
     2 
     3  * linuxmuster-backup: 
     4    - minor improvements in handling incremental and differential backupsets 
     5    - backup device will be temporarily removed from fstab during backup 
     6 
     7 -- Thomas Schmitt <schmitt@lmz-bw.de>  Wed, 26 Nov 2008 18:43:19 +0100 
     8 
    19linuxmuster-base (1.4.42-1) testing; urgency=low 
    210 
  • main/linuxmuster-base/trunk/sbin/linuxmuster-backup

    r351 r360  
    55# schmitt@lmz-bw.de 
    66# 
    7 # 23.11.2008 
     7# 26.11.2008 
    88# 
    99 
     
    1616. $HELPERFUNCTIONS || exit 1 
    1717 
    18 # default return code 
    19 RC=0 
    2018 
    2119# default values 
    2220mondocache=/var/cache/mondo 
    23 difflevel="difflevel.0" 
     21cachefiles="difflevel.0" 
    2422verify=yes 
    2523isoprefix=server 
     
    170168 
    171169    *) 
    172         error "Unknown restore method!" 
     170        echo "Unknown restore method!" 
     171        error 
    173172        ;; 
    174173 
     
    207206# shut down services 
    208207if [ -n "$services" ]; then 
    209  
    210208        echo "Shutting down services ..." 
    211  
    212209        if [ "$services" = "all" ]; then 
    213  
    214210                for s in `ls -r /etc/rc${rl}.d/S*`; do 
    215  
    216211                        $s stop 
    217  
    218212                done 
    219          
    220213        else 
    221  
    222214                for s in $services; do 
    223  
    224215                        [ -e /etc/rc${rl}.d/S??${s} ] && echo /etc/rc${rl}.d/S??${s} >> $stmp 
    225  
    226216                done 
    227  
    228217                if [ -s "$stmp" ]; then 
    229  
    230218                        for s in `sort -r $stmp`; do 
    231  
    232219                                $s stop 
    233  
    234220                        done 
    235  
    236221                else 
    237  
    238222                        echo "No services to shut down!" 
    239  
    240223                fi 
    241  
    242         fi 
    243  
     224        fi 
    244225fi 
    245226 
     
    270251backuptime=`date +%s` 
    271252 
     253RC=0 
    272254 
    273255# determine last backup set 
    274256case $btype in 
    275  
    276257        diff) 
    277258                # difflevel of last full backup 
    278259                if sets=`ls -dr $mountpoint/$isoprefix/*-*_full`; then 
    279  
    280260                        lastset=`echo $sets | awk '{ print $1 }'` 
    281261                        echo "Found last full backup set in $lastset." 
    282                          
    283262                else 
    284  
    285263                        echo "Last full backup set not found!" 
    286264                        RC=1 
    287  
    288265                fi 
    289266                ;; 
    290  
    291267        inc) 
    292268                # difflevel of last backup (full, diff or inc) 
    293269                if sets=`ls -dr $mountpoint/$isoprefix/*-*_* | grep -G _[dfi][inu][cfl]`; then 
    294  
    295270                        lastset=`echo $sets | awk '{ print $1 }'` 
    296271                        echo "Found last backup set in $lastset." 
    297                          
    298272                else 
    299  
    300273                        echo "Last backup set not found!" 
    301274                        RC=1 
    302  
    303275                fi 
    304276                ;; 
    305  
    306277        *) 
    307278                ;; 
    308  
    309279esac 
    310  
    311280 
    312281# restore mondo-archive cache if no full backup 
    313282if [ "$btype" != "full" ]; then 
    314  
    315283        if [ -d "$lastset/cache" ]; then 
    316  
    317                 # test if difflevel file is present 
    318                 if [ -s "$lastset/cache/$difflevel" ]; then 
    319  
    320                         echo "Restoring difflevel from $lastset/cache ..." 
    321                         cp -f $lastset/cache/$difflevel $mondocache/ || RC=1 
    322  
     284                # test if all cachefiles are present 
     285                echo "Testing cachefiles in $lastset/cache ..." 
     286                for i in $cachefiles; do 
     287                        [ -e "$lastset/cache/$i" ] || RC=1 
     288                done 
     289                if [ "$RC" -eq 0 ]; then 
     290                        echo "Restoring cache from $lastset/cache ..." 
     291                        rsync -a --delete $lastset/cache/ $mondocache/ 
    323292                else 
    324  
    325                         echo "$lastset/cache/$difflevel is missing!" 
    326                         echo "Cannot restore difflevel!" 
    327                         RC=1 
    328  
     293                        echo "At least one of $cachefiles is missing!" 
     294                        echo "Cannot restore cache!" 
    329295                fi 
    330  
    331296        else 
    332  
    333                 echo "Cache directory $lastset/cache does not exist! Cannot restore difflevel!" 
     297                echo "$lastset/cache does not exist! Cannot restore cache!" 
    334298                RC=1 
    335  
    336         fi 
    337  
     299        fi 
    338300fi 
    339301 
     
    348310 
    349311 
     312# remove backupdevice from fstab 
     313if [ $RC -eq 0 ]; then 
     314        if grep -q ^$backupdevice /etc/fstab; then 
     315                echo "Removing backup device $backupdevice from /etc/fstab!" 
     316                fstabtmp=/var/tmp/fstab.$$ 
     317                cp -f /etc/fstab $fstabtmp || RC=1 
     318                grep -v $backupdevice $fstabtmp > /etc/fstab || RC=1 
     319        fi 
     320fi 
     321 
     322 
    350323# starting mondoarchive 
    351324if [ $RC -eq 0 ]; then 
     
    355328 
    356329 
     330# restoring fstab 
     331if [ -n "$fstabtmp" -a -e "$fstabtmp" ]; then 
     332        echo "Restoring /etc/fstab!" 
     333        mv -f $fstabtmp /etc/fstab 
     334fi 
     335 
     336 
    357337# if mondoarchive exits cleanly 
    358338if [ "$RC" = "0" ]; then 
     
    360340        echo "mondoarchive finished successfully!" 
    361341 
    362         # store difflevel 
    363         echo "Storing difflevel to $mountpoint/$isoprefix/$bfolder/cache ..." 
    364         cp -f $mondocache/$difflevel $mountpoint/$isoprefix/$bfolder/cache/ 
     342        # store cache files 
     343        echo "Storing cache to $mountpoint/$isoprefix/$bfolder/cache ..." 
     344        rsync -a --delete $mondocache/ $mountpoint/$isoprefix/$bfolder/cache/ 
    365345 
    366346        case $btype in 
     
    387367                        setstokeep=$keepdiff 
    388368                        # store difflevel 
    389                         echo $backuptime > $mountpoint/$isoprefix/$bfolder/cache/$difflevel 
     369                        echo $backuptime > $mountpoint/$isoprefix/$bfolder/cache/difflevel.0 
    390370                        ;; 
    391371 
    392372                inc) 
    393373                        setstokeep=$keepinc 
    394                         echo $backuptime > $mountpoint/$isoprefix/$bfolder/cache/$difflevel 
     374                        echo $backuptime > $mountpoint/$isoprefix/$bfolder/cache/difflevel.0 
    395375                        ;; 
    396376 
Note: See TracChangeset for help on using the changeset viewer.