diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6ed72..d578e25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ ## Changelog ### v7.1.0-beta.1 (coming soon) -* testing strict mode for iobroker-startup.sh -* fixing "unary operator expected" error +* add restart option to maintenance script +* enhance logging +* test strict mode for iobroker-startup.sh +* fix "unary operator expected" error ### v7.0.1 (05.07.2022) * backitup restore patch diff --git a/debian/scripts/iobroker_startup.sh b/debian/scripts/iobroker_startup.sh index 97534c0..5bbf941 100644 --- a/debian/scripts/iobroker_startup.sh +++ b/debian/scripts/iobroker_startup.sh @@ -37,8 +37,8 @@ echo -n "$(printf -- '-%.0s' {1..25})" && echo -n " "$dati" " && echo " echo "$(printf -- '-%.0s' {1..80})" echo ' ' echo "$(printf -- '-%.0s' {1..80})" -echo "----- Welcome to your ioBroker-container! -----" -echo "----- Startupscript is now running. -----" +echo "----- Welcome to your ioBroker Docker container! -----" +echo "----- Startupscript is now running! -----" echo "----- Please be patient! -----" echo "$(printf -- '-%.0s' {1..80})" echo ' ' @@ -486,6 +486,7 @@ echo "$(printf -- '-%.0s' {1..80})" echo ' ' echo "Starting ioBroker..." echo ' ' +echo "##### #### ### ## # iobroker.js-controller log output # ## ### #### #####" # Setting healthcheck status to "running" echo "running" > /opt/scripts/.docker_config/.healthcheck diff --git a/debian/scripts/maintenance.sh b/debian/scripts/maintenance.sh index a6c9788..13c6852 100644 --- a/debian/scripts/maintenance.sh +++ b/debian/scripts/maintenance.sh @@ -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 ;;