Documentation, remove redundant code, spacing
This commit is contained in:
parent
f77ffd6543
commit
c0f6ed10a8
@ -32,7 +32,6 @@ case $selection in
|
||||
;;
|
||||
4)
|
||||
read -rt 120 -p "What is the maximun number of backups you would like?: " number_of_backups || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||
backup="true"
|
||||
;;
|
||||
5)
|
||||
restore
|
||||
|
@ -51,7 +51,7 @@ do
|
||||
mapfile -t full_path < <(zfs list | grep "$volume_name" | awk '{print $1}')
|
||||
if [[ "${#full_path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup.
|
||||
echo "$app is using the same volume identifier on more than one pool.. attempting to use your current kubernetes apps pool"
|
||||
pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r")
|
||||
pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")
|
||||
full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}')
|
||||
fi
|
||||
echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name"
|
||||
@ -90,7 +90,7 @@ do
|
||||
mapfile -t path < <(find /mnt/*/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-)
|
||||
if [[ "${#path[@]}" -gt 1 ]]; then #if there is another app with the same name on another pool, use the current pools application, since the other instance is probably old, or unused, or a backup.
|
||||
echo "$i is a name used on more than one pool.. attempting to use your current kubernetes apps pool"
|
||||
pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r")
|
||||
pool=$(cli -c 'app kubernetes config' | grep -E "pool\s\|" | awk -F '|' '{print $3}' | tr -d " \t\n\r")
|
||||
full_path=$(find /mnt/"$pool"/ix-applications/releases/"$app"/volumes/ -maxdepth 0 | cut -c 6-)
|
||||
zfs set mountpoint=legacy "$full_path""$pvc"
|
||||
echo "$i unmounted" && rmdir /mnt/heavyscript/"$i" || echo "failed to unmount $i"
|
||||
|
@ -136,6 +136,8 @@ count=0
|
||||
if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then
|
||||
while true
|
||||
do
|
||||
|
||||
# If app reports ACTIVE right away, assume its a false positive and wait for it to change, or trust it after 5 updates to all_app_status
|
||||
status=$(grep "^$app_name," all_app_status | awk -F ',' '{print $2}')
|
||||
if [[ $count -lt 1 && $status == "ACTIVE" && "$(grep "^$app_name," deploying 2>/dev/null | awk -F ',' '{print $2}')" != "DEPLOYING" ]]; then # If status shows up as Active or Stopped on the first check, verify that. Otherwise it may be a false report..
|
||||
[[ "$verbose" == "true" ]] && echo_array+=("Verifying $status..")
|
||||
@ -152,6 +154,7 @@ if [[ $rollback == "true" || "$startstatus" == "STOPPED" ]]; then
|
||||
done
|
||||
fi
|
||||
(( count++ ))
|
||||
|
||||
if [[ "$status" == "ACTIVE" ]]; then
|
||||
if [[ "$startstatus" == "STOPPED" ]]; then
|
||||
[[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..")
|
||||
|
@ -66,7 +66,6 @@ do
|
||||
number_of_backups=$OPTARG
|
||||
! [[ $OPTARG =~ ^[0-9]+$ ]] && echo -e "Error: -b needs to be assigned an interger\n\"""$number_of_backups""\" is not an interger" >&2 && exit
|
||||
[[ "$number_of_backups" -le 0 ]] && echo "Error: Number of backups is required to be at least 1" && exit
|
||||
backup="true"
|
||||
;;
|
||||
r)
|
||||
rollback="true"
|
||||
@ -138,14 +137,14 @@ done
|
||||
[[ "$dns" == "true" ]] && dns && exit
|
||||
[[ "$restore" == "true" ]] && restore && exit
|
||||
[[ "$mount" == "true" ]] && mount && exit
|
||||
if [[ "$backup" == "true" && "$sync" == "true" ]]; then # Run backup and sync at the same time
|
||||
if [[ "$backup" -gt 1 && "$sync" == "true" ]]; then # Run backup and sync at the same time
|
||||
echo "🅃 🄰 🅂 🄺 🅂 :"
|
||||
echo -e "-Backing up ix-applications Dataset\n-Syncing catalog(s)"
|
||||
echo -e "This can take a LONG time, Please Wait For Both Output..\n\n"
|
||||
backup &
|
||||
sync &
|
||||
wait
|
||||
elif [[ "$backup" == "true" && -z "$sync" ]]; then # If only backup is true, run it
|
||||
elif [[ "$backup" -gt 1 && -z "$sync" ]]; then # If only backup is true, run it
|
||||
echo "🅃 🄰 🅂 🄺 :"
|
||||
echo -e "-Backing up \"ix-applications\" Dataset\nPlease Wait..\n\n"
|
||||
backup
|
||||
|
Loading…
Reference in New Issue
Block a user