]> git.ipfire.org Git - people/amarx/ipfire-2.x.git/commitdiff
BUG10835: Always make backup from ramdisk in .bak dir BUG10835
authorAlexander Marx <alexander.marx@ipfire.org>
Wed, 13 May 2015 09:22:11 +0000 (11:22 +0200)
committerAlexander Marx <alexander.marx@ipfire.org>
Wed, 13 May 2015 09:22:11 +0000 (11:22 +0200)
src/initscripts/init.d/collectd
src/initscripts/init.d/functions
src/initscripts/init.d/vnstat

index eee00aa62dc6f3ce61194060c43483a9dc8789cb..69dc94c6faa966674bc518be9b0ef1a9b0c04c34 100644 (file)
@@ -33,11 +33,7 @@ case "$1" in
                                restore_ramdisk "$RRDLOG"
                        fi
                else
-                       #if backup directory contains data, the amount of memory was possibly increased, we can copy the files to Disk
-                       if [ $(find "$RRDLOG.bak" | wc -l) -ne 1 ]; then
-                               cp -pR $RRDLOG.bak/* $RRDLOG/
-                               rm -rf $RRDLOG.bak/*
-                       fi
+                       restore_ramdisk "$RRDLOG"
                fi
                        #
                        # Move /var/spool/cron to ramdisk and make a symlink
index 9f86f9a9fdc5c8c0b9494eca212f834cea7da58f..ec3e512ec74434e60a6768f8511201101567f4d1 100644 (file)
@@ -720,13 +720,11 @@ umount_ramdisk() {
 }
 
 backup_ramdisk() {
-       if [ mountpoint $1 &>/dev/null ] || [ $(find "$1.bak" | wc -l) -ne 1 ]; then
                if [ ! -e $1.bak ]; then
                        mkdir -p $1.bak
                fi
                cp -pR $1/* $1.bak/
                rm -rf $1/*
-       fi
 }
 
 restore_ramdisk() {
index 42a761bd23bc6f1735fcf67a783a7e999b4a5fcb..2e4a87874fb9f76a8645d7aa599e22bee74ee279 100755 (executable)
@@ -23,11 +23,7 @@ case "$1" in
                                $0 restore
                        fi
                else
-                       #if backup directory contains data, the amount of memory was possibly increased, we can copy the files to Disk
-                       if [ $(find "$VNSTATLOG.bak" | wc -l) -ne 1 ]; then
-                               cp -pR $VNSTATLOG.bak/* $VNSTATLOG/
-                               rm -rf $VNSTATLOG.bak/*
-                       fi
+                       restore_ramdisk "$VNSTATLOG"
                fi
                ;;
        stop)