penguin/utils

my env utils

commit 541b71e9acd5b9099a459dfd418d0ef767fb11a9

author斟酌 鵬兄 <tgckpg@gmail.com>
date2014-01-27T01:26:16Z
subjectReducing the chance of name conflicts
commit 541b71e9acd5b9099a459dfd418d0ef767fb11a9
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2014-01-27T01:26:16Z

    Reducing the chance of name conflicts
---
 bash/cronbackup/backup.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bash/cronbackup/backup.sh b/bash/cronbackup/backup.sh
index f816d15..a50cbd4 100644
--- a/bash/cronbackup/backup.sh
+++ b/bash/cronbackup/backup.sh
@@ -21,7 +21,6 @@ fi
 
 echo Begin backup schedule:
 echo Date: $(date)
-echo $'\n'
 
 while read line; do
 
@@ -57,9 +56,9 @@ while read line; do
 			fi
 			
 			# count backup file
-			fCount=$(ls $BAKDIR/*$FILENAME*.gz|wc -l)
+			fCount=$(ls $BAKDIR/$FILENAME.[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].tar.gz|wc -l)
 
-			echo   Checking for expired backups $FILENAME \($fCount\)
+			echo "  Check for existing backups "$FILENAME \(Have: $fCount\)
 			
 			# keep up to 7 backup
 			if [ $fCount -ne 7 ]; then
@@ -72,6 +71,7 @@ while read line; do
 					if [ 0 -lt $dCount ]; then
 						
 						# remove expired file
+						echo "    Removing expired backup: "$files
 						rm "$files";
 						
 						# dCount --