diff --git a/deployment/scripts/cluster.backup.sh b/deployment/scripts/cluster.backup.sh index bfa246ca4..a68886e0a 100755 --- a/deployment/scripts/cluster.backup.sh +++ b/deployment/scripts/cluster.backup.sh @@ -22,7 +22,8 @@ KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeco BACKUP_DATE=$(date "+%F_%H-%M-%S") BACKUP_FOLDER=${BACKUP_FOLDER:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/backup/${BACKUP_DATE}} -# create backup fodler +printf "Backup folder name: %s\n" $BACKUP_DATE +# create backup folder mkdir -p ${BACKUP_FOLDER} # cluster maintenance mode on && Neo4j maintenance mode on diff --git a/deployment/scripts/clusters.backup-multiple-servers.sh b/deployment/scripts/clusters.backup-multiple-servers.sh index 88d881b62..fa448871d 100755 --- a/deployment/scripts/clusters.backup-multiple-servers.sh +++ b/deployment/scripts/clusters.backup-multiple-servers.sh @@ -81,15 +81,16 @@ do cd $path printf "In\n '$path'\n remove:\n" - # TODO: replace 'ls' by 'find . -type d -maxdepth 1'? description: https://unix.stackexchange.com/questions/28939/how-to-delete-the-oldest-directory-in-a-given-directory - while [ `ls -1 | wc -l` -gt $keep ]; do - oldest=`ls -c1 | head -1` - echo " $oldest" + while [ `ls -1 | wc -l` -gt $keep ]; do + # TODO: because 'ls' is not always relyable maybe replace 'ls' by 'find . -type d -maxdepth 1'? description: https://unix.stackexchange.com/questions/28939/how-to-delete-the-oldest-directory-in-a-given-directory + # I tested this, but 'find' this is crutial, because of shell compatibilities + oldest=`ls -c1 | sort -n | head -1` + printf " %s\n" $oldest rm -rf $oldest done - printf "Keep the last %d backups:\n " $BACKUP_SAVED_BACKUPS_NUMBER - ls + printf "Keep the last %d backups:\n" $BACKUP_SAVED_BACKUPS_NUMBER + ls -c1 | sort -n | awk '{print " " $0}' cd $SCRIPT_DIR else