+ if [ ! -f "${trm_vpnfile}" ] || { [ -f "${trm_vpnfile}" ] && [ "${vpn_action}" = "enable" ]; }; then
+ for iface in ${trm_vpnifacelist}; do
+ vpn_status="$(ifstatus "${iface}" | jsonfilter -q -l1 -e '@.up')"
+ if [ "${vpn_status}" = "true" ]; then
+ ifdown "${iface}"
+ f_log "info" "take down vpn interface '${iface}' (initial)"
+ fi
+ done
+ [ -x "/etc/init.d/openvpn" ] && /etc/init.d/openvpn stop
+ if [ -f "/etc/init.d/sysntpd" ]; then
+ /etc/init.d/sysntpd restart >/dev/null 2>&1
+ fi
+ rm -f "${trm_vpnfile}"
+ elif [ "${vpn}" = "1" ] && [ -n "${vpn_iface}" ] && [ "${vpn_action}" = "enable_keep" ]; then
+ for iface in ${trm_vpnifacelist}; do
+ vpn_status="$(ifstatus "${iface}" | jsonfilter -q -l1 -e '@.up')"
+ if [ "${vpn_status}" = "true" ] && [ "${iface}" != "${vpn_iface}" ]; then
+ ifdown "${iface}"
+ [ -x "/etc/init.d/openvpn" ] && /etc/init.d/openvpn stop
+ f_log "info" "take down vpn interface '${iface}' (switch)"
+ rm -f "${trm_vpnfile}"
+ break
+ fi
+ done
+ fi
+ if [ -x "${trm_vpnpgm}" ] && [ -n "${vpn_service}" ] && [ -n "${vpn_iface}" ] && [ -f "${trm_ntpfile}" ]; then