fix running maintenance script as iobroker

This commit is contained in:
buanet
2023-07-08 22:58:11 +02:00
parent 4fe9c10771
commit aa58edd9e1
4 changed files with 13 additions and 13 deletions

View File

@@ -1 +1 @@
v8.1.0-beta.3 v8.1.0-beta.4

View File

@@ -1,10 +1,12 @@
## Changelog ## Changelog
### v8.1.0-beta.3 (05.07.2023) ### v8.1.0-beta.4 (coming soon)
* fix permission issue for restart container as iobroker user * fix running maintenance script as iobroker
* fix issue with js-controller ui upgrade * v8.1.0-beta.3 (05.07.2023)
* fix small issues in maintenance script * fix permission issue for restart container as iobroker user
* update action workflows * fix issue with js-controller ui upgrade
* fix small issues in maintenance script
* update action workflows
* v8.1.0-beta.2 (26.04.2023) * v8.1.0-beta.2 (26.04.2023)
* prohibit restore when startup script is still running * prohibit restore when startup script is still running
* extend time before restart after restore is done * extend time before restart after restore is done

View File

@@ -149,9 +149,9 @@ if [[ -f /opt/.first_run ]]; then
echo ' ' echo ' '
# Register maintenance script # Register maintenance script
echo -n 'Registering maintenance script as command... ' echo -n 'Registering maintenance script as command... '
echo "alias maintenance=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc echo "alias maintenance='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo "alias maint=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc echo "alias maint='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo "alias m=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc echo "alias m='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo 'Done.' echo 'Done.'
else else
echo "This is not the first run of this container. Skipping first run preparation." echo "This is not the first run of this container. Skipping first run preparation."

View File

@@ -152,22 +152,20 @@ stop_iob() {
pkill -u iobroker -f 'iobroker.js-controller[^/]*$' pkill -u iobroker -f 'iobroker.js-controller[^/]*$'
status=$? status=$?
if (( status >= 2 )); then # syntax error or fatal error if (( status >= 2 )); then # syntax error or fatal error
echo 'fatal error' #for logging
return 1 return 1
fi fi
if (( status == 1 )); then # no processes matched if (( status == 1 )); then # no processes matched
echo 'no process matched' #for logging
return return
fi fi
if [[ "$killbyname" != yes ]]; then if [[ "$killbyname" != yes ]]; then
# pgrep exits with status 1 when there are no matches # pgrep exits with status 1 when there are no matches
while pgrep -u iobroker > /dev/null; (( $? != 1 )); do while pgrep -u iobroker -f 'io.' > /dev/null; (( $? != 1 )); do
if (($(date +%s) > timeout)); then if (($(date +%s) > timeout)); then
echo -e '\nTimeout reached. Killing remaining processes...' echo -e '\nTimeout reached. Killing remaining processes...'
pgrep --list-full -u iobroker pgrep --list-full -u iobroker
pkill --signal SIGKILL -u iobroker pkill --signal SIGKILL -u iobroker -f 'io.'
echo 'Done.' echo 'Done.'
return return
fi fi