Skip to content

Commit

Permalink
v8.1.0-beta.3
Browse files Browse the repository at this point in the history
  • Loading branch information
buanet committed Jul 5, 2023
1 parent f225536 commit 3d83c7f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.1.0-beta.2
v8.1.0-beta.3
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
## Changelog

### v8.1.0-beta.2 (coming soon)
* prohibit restore when startup script is still running
* extend time before restart after restore is done
* influx data repo will be added automatically when PACKAGES contains influxdb or influxdb2-cli package
### v8.1.0-beta.3 (05.07.2023)
* fix issue with js-controller ui upgrade
* fix small issues in maintenance script
* update action workflows
* v8.1.0-beta.2 (26.04.2023)
* prohibit restore when startup script is still running
* extend time before restart after restore is done
* influx data repo will be added automatically when PACKAGES contains influxdb or influxdb2-cli package
* v8.1.0-beta.1 (14.04.2023)
* enhance github actions
* enhance log output of maintenance script on restore ([#333](https://github.com/buanet/ioBroker.docker/issues/333))
Expand Down
82 changes: 34 additions & 48 deletions debian/scripts/maintenance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,40 +59,24 @@ enable_maintenance() {
return
fi

if [[ "$killbyname" == yes ]]; then
# undocumented option, only for use with backitup restore scripts
# stops iobroker by terminating js-controller process by name (the old way)
echo 'This command will activate maintenance mode and stop js-controller.'
echo 'Activating maintenance mode...'
echo 'maintenance' > "$healthcheck"
sleep 1
echo 'Done.'
echo -n 'Stopping ioBroker...'
pkill -u iobroker -f iobroker.js-controller
sleep 5
echo 'Done.'
return
fi

echo 'You are now going to stop ioBroker and activate maintenance mode for this container.'

if [[ "$autoconfirm" != yes ]]; then
local reply
if [[ "$killbyname" != yes ]]; then
if [[ "$autoconfirm" != yes ]]; then
local reply

read -rp 'Do you want to continue [yes/no]? ' reply
if [[ "$reply" == y || "$reply" == Y || "$reply" == yes ]]; then
read -rp 'Do you want to continue [yes/no]? ' reply
if [[ "$reply" == y || "$reply" == Y || "$reply" == yes ]]; then
: # continue
else
return 1
else
return 1
fi
fi
else
echo 'This command was already confirmed by the -y or --yes option.'
fi

echo 'Activating maintenance mode...'
echo 'maintenance' > "$healthcheck"
sleep 1
echo 'Done.'
echo -n 'Stopping ioBroker...'
stop_iob
}
Expand All @@ -116,8 +100,6 @@ disable_maintenance() {
else
return 1
fi
else
echo 'This command was already confirmed by the -y or --yes option.'
fi

echo 'Deactivating maintenance mode and forcing container to stop or restart...'
Expand All @@ -142,8 +124,6 @@ upgrade_jscontroller() {
else
return 1
fi
else
echo 'This command was already confirmed by the -y or --yes option.'
fi

if ! maintenance_enabled > /dev/null; then
Expand All @@ -169,29 +149,37 @@ stop_iob() {
local status timeout

timeout="$(date --date="now + $pkill_timeout sec" +%s)"
pkill -u iobroker -f iobroker.js-controller
pkill -u iobroker -f 'iobroker.js-controller[^/]*$'
status=$?
if (( status >= 2 )); then # syntax error or fatal error
echo 'fatal error' #for logging
return 1
fi

if (( status == 1 )); then # no processes matched
echo 'no process matched' #for logging
return
fi

# pgrep exits with status 1 when there are no matches
while pgrep -u iobroker > /dev/null; (( $? != 1 )); do
if (($(date +%s) > timeout)); then
echo -e '\nTimeout reached. Killing remaining processes...'
pgrep --list-full -u iobroker
pkill --signal SIGKILL -u iobroker
echo 'Done.'
return
fi

echo -n '.'
sleep 1
done
if [[ "$killbyname" != yes ]]; then
# pgrep exits with status 1 when there are no matches
while pgrep -u iobroker > /dev/null; (( $? != 1 )); do
if (($(date +%s) > timeout)); then
echo -e '\nTimeout reached. Killing remaining processes...'
pgrep --list-full -u iobroker
pkill --signal SIGKILL -u iobroker
echo 'Done.'
return
fi
echo -n '.'
sleep 1
done
else
for ((i=0; i<3; i++)); do
sleep 1
echo -n '.'
done
fi

echo -e '\nDone.'
}
Expand All @@ -210,12 +198,12 @@ restart_container() {
else
return 1
fi
else
echo 'This command was already confirmed by the -y or --yes option.'
fi

echo -n 'Stopping ioBroker...'
stop_iob
if ! maintenance_enabled > /dev/null; then
echo -n 'Stopping ioBroker...'
stop_iob
fi

echo 'Container will be stopped or restarted in 5 seconds...'
sleep 5
Expand All @@ -238,8 +226,6 @@ restore_iobroker() {
else
return 1
fi
else
echo 'This command was already confirmed by the -y or --yes option.'
fi

if check_starting > /dev/null; then
Expand Down

0 comments on commit 3d83c7f

Please sign in to comment.