test loop
This commit is contained in:
parent
5858610851
commit
26815e9783
@ -30,6 +30,8 @@ export -f backup
|
|||||||
|
|
||||||
|
|
||||||
deleteBackup(){
|
deleteBackup(){
|
||||||
|
while true
|
||||||
|
do
|
||||||
clear -x && echo "pulling all restore points.."
|
clear -x && echo "pulling all restore points.."
|
||||||
list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t)
|
list_backups=$(cli -c 'app kubernetes list_backups' | sort -t '_' -Vr -k2,7 | tr -d " \t\r" | awk -F '|' '{print $2}' | nl | column -t)
|
||||||
clear -x
|
clear -x
|
||||||
@ -46,16 +48,16 @@ restore_point=$(echo "$list_backups" | grep ^"$selection " | awk '{print $2}')
|
|||||||
#Check for valid selection. If none, kill script
|
#Check for valid selection. If none, kill script
|
||||||
if [[ -z "$selection" ]]; then
|
if [[ -z "$selection" ]]; then
|
||||||
echo "Your selection cannot be empty"
|
echo "Your selection cannot be empty"
|
||||||
exit
|
continue
|
||||||
elif [[ -z "$restore_point" ]]; then
|
elif [[ -z "$restore_point" ]]; then
|
||||||
echo "Invalid Selection: $selection, was not an option"
|
echo "Invalid Selection: $selection, was not an option"
|
||||||
exit
|
continue
|
||||||
fi
|
fi
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point"
|
echo -e "\nWARNING:\nYou CANNOT go back after deleting your restore point"
|
||||||
echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?"
|
echo -e "\n\nYou have chosen:\n$restore_point\n\nWould you like to continue?"
|
||||||
echo -e "Yes\n0 exit"
|
echo -e "Yes\n0 exit\n"
|
||||||
read -rt 120 -p "Type \"yes\" to continue, or exit with \"0\": " yesno
|
read -rt 120 -p "Type \"yes\" to continue, or exit with \"0\": " yesno
|
||||||
case $yesno in
|
case $yesno in
|
||||||
[Yy][Ee][Ss])
|
[Yy][Ee][Ss])
|
||||||
@ -73,14 +75,29 @@ do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
# while true
|
while true
|
||||||
# do
|
do
|
||||||
# echo "Delete more?"
|
echo "Delete more?"
|
||||||
# echo
|
echo "1 Yes"
|
||||||
|
echo "2 No"
|
||||||
|
read -rt 120 -p "Please type a number: " yesno
|
||||||
|
case $yesno in
|
||||||
|
1)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$yesno was not an option, try again"
|
||||||
|
sleep 2
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
# done
|
done
|
||||||
|
done
|
||||||
}
|
}
|
||||||
export -f deleteBackup
|
export -f deleteBackup
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user