Run openconnect calls in an endless loop with 60s sleep on failure

This commit is contained in:
Wolfgang Klinger 2019-10-17 17:45:23 +02:00
parent d7bba950af
commit 46e2544936

View File

@ -5,6 +5,7 @@ sed "s/^Port .*$/Port 8888/" -i /etc/tinyproxy.conf
/usr/local/bin/microsocks -i 0.0.0.0 -p 8889 & /usr/local/bin/microsocks -i 0.0.0.0 -p 8889 &
run () {
# Start openconnect # Start openconnect
if [[ -z "${OPENCONNECT_PASSWORD}" ]]; then if [[ -z "${OPENCONNECT_PASSWORD}" ]]; then
# Ask for password # Ask for password
@ -16,3 +17,10 @@ elif [[ ! -z "${OPENCONNECT_PASSWORD}" ]]; then
# Standard authentication # Standard authentication
echo $OPENCONNECT_PASSWORD | openconnect -u $OPENCONNECT_USER $OPENCONNECT_OPTIONS --passwd-on-stdin $OPENCONNECT_URL echo $OPENCONNECT_PASSWORD | openconnect -u $OPENCONNECT_USER $OPENCONNECT_OPTIONS --passwd-on-stdin $OPENCONNECT_URL
fi fi
}
until (run); do
echo "openconnect exited. Restarting process in 60 seconds…" >&2
sleep 60
done