From 4a4238e196b971513d353177740f5260de67d71b Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Wed, 13 May 2015 11:22:11 +0200 Subject: [PATCH] BUG10835: Always make backup from ramdisk in .bak dir --- src/initscripts/init.d/collectd | 6 +----- src/initscripts/init.d/functions | 2 -- src/initscripts/init.d/vnstat | 6 +----- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/initscripts/init.d/collectd b/src/initscripts/init.d/collectd index eee00aa62..69dc94c6f 100644 --- a/src/initscripts/init.d/collectd +++ b/src/initscripts/init.d/collectd @@ -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 diff --git a/src/initscripts/init.d/functions b/src/initscripts/init.d/functions index 9f86f9a9f..ec3e512ec 100644 --- a/src/initscripts/init.d/functions +++ b/src/initscripts/init.d/functions @@ -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() { diff --git a/src/initscripts/init.d/vnstat b/src/initscripts/init.d/vnstat index 42a761bd2..2e4a87874 100755 --- a/src/initscripts/init.d/vnstat +++ b/src/initscripts/init.d/vnstat @@ -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) -- 2.47.2