addinf update parameter to maintenance script

This commit is contained in:
buanet
2021-05-06 22:40:28 +02:00
parent a615fea709
commit 6392a19cac

View File

@@ -13,7 +13,7 @@ then
fi fi
elif [ "$1" == "on" ] elif [ "$1" == "on" ]
then then
echo 'You are going to stop ioBroker and activating maintenance mode for this container.' echo 'You are now going to stop ioBroker and activating maintenance mode for this container.'
read -p 'Do you want to continue [yes/no]? ' A read -p 'Do you want to continue [yes/no]? ' A
if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ] if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ]
then then
@@ -31,13 +31,43 @@ then
fi fi
elif [ "$1" == "off" ] elif [ "$1" == "off" ]
then then
echo 'You are going to deactivate maintenance mode for this container.' echo 'You are now going to deactivate maintenance mode for this container.'
echo 'Depending of the restart policy of this container, this will stop/ restart your container immediately.' echo 'Depending on the restart policy, your container will be stopped/ restarted immediately.'
read -p 'Do you want to continue [yes/no]? ' A read -p 'Do you want to continue [yes/no]? ' A
if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ] if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ]
then then
echo 'Deactivating maintenance mode and forcing container to stop/ restart...' echo 'Deactivating maintenance mode and forcing container to stop/ restart...'
echo "stopping" > /opt/scripts/.docker_config/.healthcheck
pkill -u root
exit 0
else
exit 0
fi
elif [ "$1" == "upgrade" ]
then
echo 'You are now going to upgrade your js-controller.'
echo 'As this will change data in /opt/iobroker, make sure you have a backup!'
echo 'During the upgrade process the container will automatically switch into maintenance mode and stop ioBroker.'
echo 'Depending of the restart policy, you container will be stoped/ restarted automatically after the upgrade.'
read -p 'Do you want to continue [yes/no]? ' A
if [ "$A" == "y" ] || [ "$A" == "Y" ] || [ "$A" == "yes" ]
then
echo 'Activating maintenance mode...'
echo "maintenance" > /opt/scripts/.docker_config/.healthcheck echo "maintenance" > /opt/scripts/.docker_config/.healthcheck
sleep 1
echo 'Done.'
echo 'Stopping ioBroker...'
pkill -u iobroker
sleep 1
echo 'Done.'
echo 'Upgrading js-controller...'
iobroker update
iobroker upgrade self
sleep 1
echo 'Done.'
echo 'Container will be stopped/ restarted in 5 seconds...'
sleep 5
echo "stopping" > /opt/scripts/.docker_config/.healthcheck
pkill -u root pkill -u root
exit 0 exit 0
else else