mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Revert "Add several curly brackets to script 'clusters.backup-multiple-servers.sh', because not all is function well on the backup server"
This reverts commit 4c9d588e9a8695bab31e7f1e4af6322fc5d5fb00.
This commit is contained in:
parent
4c9d588e9a
commit
72978889ef
@ -12,13 +12,13 @@ SCRIPT_PATH=$(realpath $0)
|
|||||||
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
|
SCRIPT_DIR=$(dirname $SCRIPT_PATH)
|
||||||
|
|
||||||
# debugging
|
# debugging
|
||||||
echo "debugging SCRIPT_PATH=${SCRIPT_PATH}"
|
echo "debugging SCRIPT_PATH=$SCRIPT_PATH"
|
||||||
echo "debugging SCRIPT_DIR=${SCRIPT_DIR}"
|
echo "debugging SCRIPT_DIR=$SCRIPT_DIR"
|
||||||
|
|
||||||
# save old CONFIGURATION for later reset
|
# save old CONFIGURATION for later reset
|
||||||
export SAVE_CONFIGURATION=${CONFIGURATION}
|
export SAVE_CONFIGURATION=$CONFIGURATION
|
||||||
# debugging
|
# debugging
|
||||||
printf "debugging SAVE_CONFIGURATION=%s\n" ${SAVE_CONFIGURATION}
|
printf "debugging SAVE_CONFIGURATION=%s\n" $SAVE_CONFIGURATION
|
||||||
|
|
||||||
# export all variables in "../.env"
|
# export all variables in "../.env"
|
||||||
set -a
|
set -a
|
||||||
@ -32,16 +32,16 @@ if [[ -z ${BACKUP_CONFIGURATIONS} ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
# debugging
|
# debugging
|
||||||
printf "debugging BACKUP_CONFIGURATIONS=%s\n" ${BACKUP_CONFIGURATIONS}
|
printf "debugging BACKUP_CONFIGURATIONS=%s\n" $BACKUP_CONFIGURATIONS
|
||||||
|
|
||||||
# convert configurations to array
|
# convert configurations to array
|
||||||
IFS=' ' read -a CONFIGURATIONS_ARRAY <<< "${BACKUP_CONFIGURATIONS}"
|
IFS=' ' read -a CONFIGURATIONS_ARRAY <<< "$BACKUP_CONFIGURATIONS"
|
||||||
|
|
||||||
# display the clusters
|
# display the clusters
|
||||||
printf "Backup the clusters:\n"
|
printf "Backup the clusters:\n"
|
||||||
for i in "${CONFIGURATIONS_ARRAY[@]}"
|
for i in "${CONFIGURATIONS_ARRAY[@]}"
|
||||||
do
|
do
|
||||||
echo " ${i}"
|
echo " $i"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ if [[ -z ${BACKUP_SAVED_BACKUPS_NUMBER} ]]; then
|
|||||||
else
|
else
|
||||||
# deleting backups?
|
# deleting backups?
|
||||||
if (( BACKUP_SAVED_BACKUPS_NUMBER >= 1 )); then
|
if (( BACKUP_SAVED_BACKUPS_NUMBER >= 1 )); then
|
||||||
printf "Keep the last %d backups for all networks.\n" ${BACKUP_SAVED_BACKUPS_NUMBER}
|
printf "Keep the last %d backups for all networks.\n" $BACKUP_SAVED_BACKUPS_NUMBER
|
||||||
else
|
else
|
||||||
echo "!!! ATTENTION: No backups are deleted !!!"
|
echo "!!! ATTENTION: No backups are deleted !!!"
|
||||||
fi
|
fi
|
||||||
@ -67,7 +67,7 @@ printf "\n"
|
|||||||
|
|
||||||
for i in "${CONFIGURATIONS_ARRAY[@]}"
|
for i in "${CONFIGURATIONS_ARRAY[@]}"
|
||||||
do
|
do
|
||||||
export CONFIGURATION=${i}
|
export CONFIGURATION=$i
|
||||||
# individual cluster backup
|
# individual cluster backup
|
||||||
${SCRIPT_DIR}/cluster.backup.sh
|
${SCRIPT_DIR}/cluster.backup.sh
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ do
|
|||||||
if (( BACKUP_SAVED_BACKUPS_NUMBER >= 1 )); then
|
if (( BACKUP_SAVED_BACKUPS_NUMBER >= 1 )); then
|
||||||
# delete all oldest backups, but leave the last BACKUP_SAVED_BACKUPS_NUMBER
|
# delete all oldest backups, but leave the last BACKUP_SAVED_BACKUPS_NUMBER
|
||||||
|
|
||||||
keep=${BACKUP_SAVED_BACKUPS_NUMBER}
|
keep=$BACKUP_SAVED_BACKUPS_NUMBER
|
||||||
path="${SCRIPT_DIR}/../configurations/${CONFIGURATION}/backup/"
|
path="$SCRIPT_DIR/../configurations/$CONFIGURATION/backup/"
|
||||||
|
|
||||||
cd $path
|
cd $path
|
||||||
|
|
||||||
@ -84,14 +84,14 @@ do
|
|||||||
# 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
|
# 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
|
while [ `ls -1 | wc -l` -gt $keep ]; do
|
||||||
oldest=`ls -c1 | head -1`
|
oldest=`ls -c1 | head -1`
|
||||||
echo " ${oldest}"
|
echo " $oldest"
|
||||||
rm -rf $oldest
|
rm -rf $oldest
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "Keep the last %d backups:\n " ${BACKUP_SAVED_BACKUPS_NUMBER}
|
printf "Keep the last %d backups:\n " $BACKUP_SAVED_BACKUPS_NUMBER
|
||||||
ls
|
ls
|
||||||
|
|
||||||
cd ${SCRIPT_DIR}
|
cd $SCRIPT_DIR
|
||||||
else
|
else
|
||||||
echo "!!! ATTENTION: No backups are deleted !!!"
|
echo "!!! ATTENTION: No backups are deleted !!!"
|
||||||
fi
|
fi
|
||||||
@ -101,7 +101,7 @@ done
|
|||||||
|
|
||||||
# reset CONFIGURATION to old
|
# reset CONFIGURATION to old
|
||||||
# TODO: clearily if this is the same as: $ export CONFIGURATION=${SAVE_CONFIGURATION}"
|
# TODO: clearily if this is the same as: $ export CONFIGURATION=${SAVE_CONFIGURATION}"
|
||||||
export CONFIGURATION=${SAVE_CONFIGURATION}
|
export CONFIGURATION=$SAVE_CONFIGURATION
|
||||||
echo "Reset to CONFIGURATION=${CONFIGURATION}"
|
echo "Reset to CONFIGURATION=$CONFIGURATION"
|
||||||
# debugging
|
# debugging
|
||||||
printf "debugging CONFIGURATION=%s\n" ${CONFIGURATION}
|
printf "debugging CONFIGURATION=%s\n" $CONFIGURATION
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user