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,6 +1,8 @@
## Changelog
### v8.1.0-beta.3 (05.07.2023)
### v8.1.0-beta.4 (coming soon)
* fix running maintenance script as iobroker
* v8.1.0-beta.3 (05.07.2023)
* fix permission issue for restart container as iobroker user
* fix issue with js-controller ui upgrade
* fix small issues in maintenance script

View File

@@ -149,9 +149,9 @@ if [[ -f /opt/.first_run ]]; then
echo ' '
# Register maintenance script
echo -n 'Registering maintenance script as command... '
echo "alias maintenance=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc
echo "alias maint=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc
echo "alias m=\'/opt/scripts/maintenance.sh\'" >> /root/.bashrc
echo "alias maintenance='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo "alias maint='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo "alias m='/opt/scripts/maintenance.sh'" >> /etc/bash.bashrc
echo 'Done.'
else
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[^/]*$'
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
if [[ "$killbyname" != yes ]]; then
# 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
echo -e '\nTimeout reached. Killing remaining processes...'
pgrep --list-full -u iobroker
pkill --signal SIGKILL -u iobroker
pkill --signal SIGKILL -u iobroker -f 'io.'
echo 'Done.'
return
fi