IPsec flush installed-sa script

Hello,

Don’t know who made the script below (thank you) just found it using search on this forum. I think it works, didn’t tested yet.
I just need your help to change it a bit for my needs.

I need to add this: after the Installed-SA are flushed it should ping 10.0.1.2 five times.

Thank you.

:local IPWatchServer 10.0.1.2
:local OutInterface bridge-lan
:if ([/ping interface=$OutInterface $IPWatchServer count=4]<3) do={
  /ip ipsec installed-sa flush sa-type=all
  :log info "IPSEC tunnel with XO is down: Flushing Installed SA !!!"
} else={
  :log info "IPSEC tunnel with XO is OK !"
}

like this?

{
:local IPWatchServer 10.0.1.2
:local OutInterface bridge-lan
:if ([/ping interface=$OutInterface $IPWatchServer count=4]<3) do={
  /ip ipsec installed-sa flush sa-type=all;
  /ping interface=$OutInterface $IPWatchServer count=5; 
  :log info "IPSEC tunnel with XO is down: Flushing Installed SA !!!"
} else={
  :log info "IPSEC tunnel with XO is OK !"
} }