enhance maintenance script

This commit is contained in:
buanet
2023-04-25 22:30:15 +02:00
parent a04f210190
commit 7a455952dd
2 changed files with 21 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
## Changelog ## Changelog
### v8.1.0-beta.2 (coming soon) ### v8.1.0-beta.2 (coming soon)
* prohibit restore when startup script is still running
* extend time before restart after restore is done
* v8.1.0-beta.1 (14.04.2023) * v8.1.0-beta.1 (14.04.2023)
* enhance github actions * enhance github actions
* enhance log output of maintenance script on restore ([#333](https://github.com/buanet/ioBroker.docker/issues/333)) * enhance log output of maintenance script on restore ([#333](https://github.com/buanet/ioBroker.docker/issues/333))

View File

@@ -38,6 +38,11 @@ maintenance_enabled() {
[[ -f "$healthcheck" && "$(cat "$healthcheck")" == maintenance ]] [[ -f "$healthcheck" && "$(cat "$healthcheck")" == maintenance ]]
} }
# check status starting
check_starting() {
[[ -f "$healthcheck" && "$(cat "$healthcheck")" == starting ]]
}
# display maintenance status # display maintenance status
maintenance_status() { maintenance_status() {
if maintenance_enabled; then if maintenance_enabled; then
@@ -221,6 +226,8 @@ restart_container() {
# restore iobroker # restore iobroker
restore_iobroker() { restore_iobroker() {
echo 'You are now going to perform a restore of your iobroker.' echo 'You are now going to perform a restore of your iobroker.'
echo 'During the restore process, the container will automatically switch into maintenance mode and stop ioBroker.'
echo 'Depending on the restart policy, your container will be stopped or restarted automatically after the restore.'
if [[ "$autoconfirm" != yes ]]; then if [[ "$autoconfirm" != yes ]]; then
local reply local reply
@@ -235,11 +242,17 @@ restore_iobroker() {
echo 'This command was already confirmed by the -y or --yes option.' echo 'This command was already confirmed by the -y or --yes option.'
fi fi
echo -n 'Stopping ioBroker...' if check_starting > /dev/null; then
stop_iob echo "Startup script is still running."
echo "Please check container log and wait until ioBroker is sucessfully started."
echo "Then try again."
return 1
fi
# fixing permission errors during restore if ! maintenance_enabled > /dev/null; then
#chown -R $setuid:$setgid /opt/iobroker/backup autoconfirm=yes
enable_maintenance
fi
echo -n "Restoring ioBroker... " echo -n "Restoring ioBroker... "
set +e set +e
@@ -263,8 +276,8 @@ restore_iobroker() {
echo "!!!! You can view installation process by taking a look at ioBroker log. !!!!" echo "!!!! You can view installation process by taking a look at ioBroker log. !!!!"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
sleep 10 sleep 10
echo 'Container will be stopped or restarted in 5 seconds...' echo 'Container will be stopped or restarted in 10 seconds...'
sleep 5 sleep 10
echo 'stopping' > "$healthcheck" echo 'stopping' > "$healthcheck"
pkill -u root pkill -u root
} }