I am trying to use the exec binding to restart an ipsec connection if I detect a remote host to be down.
I have tried the following: Switch ipsecRestart "Ipsec restart if ipcam NOK" {nh="ipcamIPAddress:80", exec=">[OFF:ssh root@routerIPAddress ipsec restart]"}
this will indeed restart ipsec if I manually switch off the switch but not when the host (ipcam) goes offline. The network health binding is working fine too.
I have no advice for getting it to work in the one Switch. But a simple rule would work. I do similar stuff in my setup with the Network Health but I separate the nh and exec into separate switches and trigger the exec in a rule.
Thanks @rlkoshak, yes a rule should be no problem, it’s just that I saw an example in the wiki and got the idea it would be possible in a one-liner item.
It very well be possible. I’ve never really tried to make it work. I like to keep such things separate and join them up with a rule. It gives me more flexibility in the long run.