PERFECT! (Almost…)
This event driven check does not properly set the VPN Active flag (My_Bit@) if the script is stopped and restarted. It reads as OFFLINE, when in fact it is ONLINE.
So, by combining your two code examples, I wound up with the following, which seems to work pretty well. There’s still a delay for the Offline event after I unplug the WAN cable of up to 30 seconds… however, that’s better than what I had.
INIT Section:
SETSYS INF, “LOAD”
a$ = GETSYS INF, “VPNIP”
IF(a$ <> “0.0.0.0”) THEN
PRINT “eWON is online”
eWON_Online@ = 1
ELSE
PRINT “eWON is offline”
eWON_Online@ = 0
ENDIF
ONVPN “GOTO ONLINE_TEST”
End
ONLINE_TEST:
w% = GETSYS PRG, “EVTINFO”
IF w% = 1 THEN
Print “VPN ONLINE”
eWON_Online@ = 1
ELSE
Print “VPN OFFLINE”
eWON_Online@ = 0
ENDIF
End
Thanks for your help!