From a7f8e9212b57632fecc03ac108021f4739d8c35b Mon Sep 17 00:00:00 2001 From: Someone Date: Fri, 18 Jan 2013 05:48:52 +0100 Subject: [PATCH] changed partitions and some output. --- cleaner.sh | 14 ++++++++------ snapshot.sh | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/cleaner.sh b/cleaner.sh index 239a95c..f623090 100755 --- a/cleaner.sh +++ b/cleaner.sh @@ -7,12 +7,12 @@ # This script will update current/last_day/week/month snapshots and will delete snapshots if needed (too many or low on space) # #set volumes to do curr/last day/month for. -LASTLIST="root home homeroot var" +LASTLIST="root home homeroot" # Autosnaps to keep. Counting/Considering *.snap only. There should be adate_*.snap snapshots only. -let MINSNAPCNT=4*5 -let MAXSNAPCNT=4*250 -MAXSPACEPERCENT=90 +let MINSNAPCNT=3*5 +let MAXSNAPCNT=3*300 +MAXSPACEPERCENT=95 echo "***START: `date`***" if [ -e /tmp/btrfs_cleaner.lock ]; then @@ -28,8 +28,9 @@ cd /mnt/btrfs for vol in $LASTLIST; do CHECK=$(grep "`date +"%Y-%m-"`" amon_curr_${vol}.txt 2> /dev/null) if [ "$CHECK" == "" ]; then - echo "Autosnap cleaner: Rotating last and current month for ${vol}" + echo "Autosnap cleaner: Rotating current month for ${vol}" if [ -e "amon_curr_${vol}.snp" -a -e "amon_curr_${vol}.txt" ]; then + echo "Autosnap cleaner: Rotating last month for ${vol}" if [ -e "amon_last_${vol}.snp" -a -e "amon_last_${vol}.txt" ]; then mv "amon_last_${vol}.snp" "`cat amon_last_${vol}.txt`" fi @@ -48,8 +49,9 @@ done for vol in $LASTLIST; do CHECK=$(grep "`date +"%Y-%m-%d"`" aday_curr_${vol}.txt 2> /dev/null) if [ "$CHECK" == "" ]; then - echo "Autosnap cleaner: Rotating last and current day for ${vol}" + echo "Autosnap cleaner: Rotating current day for ${vol}" if [ -e "aday_curr_${vol}.snp" -a -e "aday_curr_${vol}.txt" ]; then + echo "Autosnap cleaner: Rotating last day for ${vol}" if [ -e "aday_last_${vol}.snp" -a -e "aday_last_${vol}.txt" ]; then mv "aday_last_${vol}.snp" "`cat aday_last_${vol}.txt`" fi diff --git a/snapshot.sh b/snapshot.sh index 4d1439a..0ce283c 100755 --- a/snapshot.sh +++ b/snapshot.sh @@ -5,7 +5,7 @@ # This script will generate: current_$vol.snp/.txt + last_$vol.snp/.txt and date_$date_$vol.snp/.txt # # Set volumes to autosnap -SNAPLIST="root home var homeroot" +SNAPLIST="root home homeroot" # Timestamp of creation. STARTTS="`date +'%Y-%m-%d--%H-%M'`" @@ -29,6 +29,7 @@ for vol in $SNAPLIST; do echo "aadate_${STARTTS}_${vol}.snap" > ahour_curr_${vol}.txt btrfs subvolume snapshot "${vol}" "ahour_curr_${vol}.snp" touch -m -a "ahour_curr_${vol}.snp" + touch -m -a "${vol}" done cd $CALLPATH -- 2.43.0