mirror of
https://github.com/buanet/ioBroker.docker.git
synced 2025-12-17 10:29:00 +02:00
manual sync (beta branch)
This commit is contained in:
@@ -283,4 +283,4 @@
|
|||||||
* added support for avahi-daemon (installation and autostart)
|
* added support for avahi-daemon (installation and autostart)
|
||||||
|
|
||||||
### v0.0.1 (2017-01-31)
|
### v0.0.1 (2017-01-31)
|
||||||
* project started / initial release
|
* project started / initial release
|
||||||
6
debian/scripts/iobroker_startup.sh
vendored
6
debian/scripts/iobroker_startup.sh
vendored
@@ -148,9 +148,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."
|
||||||
|
|||||||
90
debian/scripts/maintenance.sh
vendored
90
debian/scripts/maintenance.sh
vendored
@@ -59,41 +59,25 @@ enable_maintenance() {
|
|||||||
return
|
return
|
||||||
fi
|
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 -n "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."
|
echo "You are now going to stop ioBroker and activate maintenance mode for this container."
|
||||||
|
|
||||||
if [[ "$autoconfirm" != yes ]]; then
|
if [[ "$killbyname" != yes ]]; then
|
||||||
local reply
|
if [[ "$autoconfirm" != yes ]]; then
|
||||||
|
local reply
|
||||||
|
|
||||||
read -rp 'Do you want to continue [yes/no]? ' reply
|
read -rp 'Do you want to continue [yes/no]? ' reply
|
||||||
if [[ "$reply" == y || "$reply" == Y || "$reply" == yes ]]; then
|
if [[ "$reply" == y || "$reply" == Y || "$reply" == yes ]]; then
|
||||||
: # continue
|
: # continue
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "This command was already confirmed by the -y or --yes option."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Activating maintenance mode..."
|
echo "Activating maintenance mode..."
|
||||||
echo "maintenance" > "$healthcheck"
|
echo "maintenance" > "$healthcheck"
|
||||||
sleep 1
|
sleep 1
|
||||||
echo "Done."
|
echo -n "Stopping ioBroker..."
|
||||||
echo -n 'Stopping ioBroker...'
|
|
||||||
stop_iob
|
stop_iob
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,13 +100,11 @@ disable_maintenance() {
|
|||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "This command was already confirmed by the -y or --yes option."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Deactivating maintenance mode and forcing container to stop or restart..."
|
echo "Deactivating maintenance mode and forcing container to stop or restart..."
|
||||||
echo "stopping" > "$healthcheck"
|
echo "stopping" > "$healthcheck"
|
||||||
pkill -u root
|
gosu root pkill -u root
|
||||||
echo "Done."
|
echo "Done."
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,8 +124,6 @@ upgrade_jscontroller() {
|
|||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "This command was already confirmed by the -y or --yes option."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! maintenance_enabled > /dev/null; then
|
if ! maintenance_enabled > /dev/null; then
|
||||||
@@ -161,7 +141,7 @@ upgrade_jscontroller() {
|
|||||||
echo "Container will be stopped or restarted in 5 seconds..."
|
echo "Container will be stopped or restarted in 5 seconds..."
|
||||||
sleep 5
|
sleep 5
|
||||||
echo "stopping" > "$healthcheck"
|
echo "stopping" > "$healthcheck"
|
||||||
pkill -u root
|
gosu root pkill -u root
|
||||||
}
|
}
|
||||||
|
|
||||||
# stop iobroker and wait until all processes stopped or pkill_timeout is reached
|
# stop iobroker and wait until all processes stopped or pkill_timeout is reached
|
||||||
@@ -169,7 +149,7 @@ stop_iob() {
|
|||||||
local status timeout
|
local status timeout
|
||||||
|
|
||||||
timeout="$(date --date="now + $pkill_timeout sec" +%s)"
|
timeout="$(date --date="now + $pkill_timeout sec" +%s)"
|
||||||
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
|
||||||
return 1
|
return 1
|
||||||
@@ -179,19 +159,25 @@ stop_iob() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# pgrep exits with status 1 when there are no matches
|
if [[ "$killbyname" != yes ]]; then
|
||||||
while pgrep -u iobroker > /dev/null; (( $? != 1 )); do
|
# pgrep exits with status 1 when there are no matches
|
||||||
if (($(date +%s) > timeout)); then
|
while pgrep -u iobroker -f 'io.' > /dev/null; (( $? != 1 )); do
|
||||||
echo -e "\nTimeout reached. Killing remaining processes..."
|
if (($(date +%s) > timeout)); then
|
||||||
pgrep --list-full -u iobroker
|
echo -e "\nTimeout reached. Killing remaining processes..."
|
||||||
pkill --signal SIGKILL -u iobroker
|
pgrep --list-full -u iobroker
|
||||||
echo "Done."
|
pkill --signal SIGKILL -u iobroker -f 'io.'
|
||||||
return
|
echo "Done."
|
||||||
fi
|
return
|
||||||
|
fi
|
||||||
echo -n "."
|
echo -n "."
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
else
|
||||||
|
for ((i=0; i<3; i++)); do
|
||||||
|
sleep 1
|
||||||
|
echo -n "."
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "\nDone."
|
echo -e "\nDone."
|
||||||
}
|
}
|
||||||
@@ -210,17 +196,17 @@ restart_container() {
|
|||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "This command was already confirmed by the -y or --yes option."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Stopping ioBroker..."
|
if ! maintenance_enabled > /dev/null; then
|
||||||
stop_iob
|
echo -n "Stopping ioBroker..."
|
||||||
|
stop_iob
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Container will be stopped or restarted in 5 seconds..."
|
echo "Container will be stopped or restarted in 5 seconds..."
|
||||||
sleep 5
|
sleep 5
|
||||||
echo "stopping" > "$healthcheck"
|
echo "stopping" > "$healthcheck"
|
||||||
pkill -u root
|
gosu root pkill -u root
|
||||||
}
|
}
|
||||||
|
|
||||||
# restore iobroker
|
# restore iobroker
|
||||||
@@ -238,8 +224,6 @@ restore_iobroker() {
|
|||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "This command was already confirmed by the -y or --yes option."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if check_starting > /dev/null; then
|
if check_starting > /dev/null; then
|
||||||
@@ -279,7 +263,7 @@ restore_iobroker() {
|
|||||||
echo "Container will be stopped or restarted in 10 seconds..."
|
echo "Container will be stopped or restarted in 10 seconds..."
|
||||||
sleep 10
|
sleep 10
|
||||||
echo "stopping" > "$healthcheck"
|
echo "stopping" > "$healthcheck"
|
||||||
pkill -u root
|
gosu root pkill -u root
|
||||||
}
|
}
|
||||||
|
|
||||||
# parsing commands and options
|
# parsing commands and options
|
||||||
|
|||||||
Reference in New Issue
Block a user