Added check for state of VM/CT to avoid errors

This commit is contained in:
2022-08-30 21:34:58 +02:00
parent 2b88178caf
commit 9e8b4a89fd
3 changed files with 37 additions and 4 deletions

View File

@@ -35,6 +35,9 @@ if ! $IdExists; then echo "This ID does not exist"; exit; fi
if [[ $VMS =~ $ID ]]; then TYPE=VM; fi
if [[ $CTS =~ $ID ]]; then TYPE=CT; fi
check#Check if VM/CT is running
if ! $($TYPE-State $ID); then echo "This ID is not runnig"; exit; fi
#Ask what should be updated
while true; do
read -p "Wich software should be updated (P)ackages, (A)pplications or (B)oth? " sofq
@@ -52,6 +55,6 @@ while true; do
$TYPE-UpdatePackages $ID
$TYPE-UpdateApplicatons $ID
break;;
* ) echo "Please answer with (A)ll, (C)T`s or (V)M`s.";;
* ) echo "Please answer with (P)ackages, (A)pplications or (B)oth.";;
esac
done