docker-transmission-openvpn/openvpn/custom/config-failure.sh
MustangGB 0a9d4b5c33
Execute a script on VPN connection failure (#2252)
* Update start.sh

* Update persistEnvironment.py

* Update modify-openvpn-config.sh

* Update tunnelUp.sh

* Update modify-openvpn-config.sh

* Update modify-openvpn-config.sh

* Update modify-openvpn-config.sh

* Update modify-openvpn-config.sh

* Create config-failure.sh

* Update config-failure.sh

* Update tunnelUp.sh

* Update modify-openvpn-config.sh
2022-05-18 12:03:29 +09:00

12 lines
360 B
Bash

#!/bin/bash
CONFIG=$1
echo "Config ${CONFIG} has failed, here might be a good place to fix it, e.g. fetch updated credentials"
# After config has been fixed, reset status to try again.
CONFIG_STATUS="unknown"
sed -i "/^; status.*$/d" "${CONFIG}"
sed -i "\$q" "${CONFIG}" # Ensure config ends with a line feed
echo "; status ${CONFIG_STATUS}" >> "${CONFIG}"