small fixes

This commit is contained in:
buanet
2022-09-19 21:54:57 +02:00
parent 15da4a272d
commit 3e40d2acd1
3 changed files with 38 additions and 4 deletions

View File

@@ -22,6 +22,7 @@ display_help() {
echo ' on > switches mantenance mode ON'
echo ' off > switches mantenance mode OFF and stops or restarts the container'
echo ' upgrade > puts the container to maintenance mode and upgrades ioBroker'
echo ' restart > stops iobroker and stops or restarts the container'
echo ' help > shows this help'
echo ''
echo 'OPTIONS'
@@ -157,6 +158,33 @@ upgrade_jscontroller() {
pkill -u root
}
# restart container
restart_container() {
echo 'You are now going to call a restart of your container.'
echo 'Restarting will work depending on the configured restart policy.'
if [[ "$autoconfirm" != yes ]]; then
local reply
read -rp 'Do you want to continue [yes/no]? ' reply
if [[ "$reply" == y || "$reply" == Y || "$reply" == yes ]]; then
: # continue
else
return 1
fi
else
echo 'This command was already confirmed by the -y or --yes option.'
fi
echo -n 'Stopping ioBroker...'
stop_iob
echo 'Container will be stopped or restarted in 5 seconds...'
sleep 5
echo 'stopping' > "$healthcheck"
pkill -u root
}
# stop iobroker and wait until all processes stopped or pkill_timeout is reached
stop_iob() {
local status timeout
@@ -211,6 +239,9 @@ for arg in "$@"; do
upgrade)
run=(upgrade_jscontroller)
;;
restart)
run=(restart_container)
;;
-y|--yes)
autoconfirm=yes
;;