IPSEC Script for Dynamic IP

Hello,

I used this script to change the IP of the IPSEC policy and remote peer.
The problem is I have 2 IPSEC remote site now and the script automatically change the 2 policy and the 2 remote peer.
How can I setup 2 script to change it individually?

I have try putting a COMMENT for the 2 Policy but that dont work?

Any help?

:local localIP [:resolve “642f053.sn.mynetname.net”];
:local resolvedIP [:resolve “remote.com”];

/ip ipsec policy disable [find] ;
/ip ipsec peer disable [find] ;

/ip ipsec policy set [find] sa-src-address=$localIP ;
/ip ipsec policy set [find] sa-dst-address=$resolvedIP ;
/ip ipsec peer set [find] address=$resolvedIP ;

/ip ipsec peer enable [find] ;
/ip ipsec policy enable [find];

/tool e-mail send to=“VPN@email.com” subject=“VPN Down” body=“VPN Down”

You can add filters for find. Add comments, then use something like this:

 / ip ipsec policy disable [ find where comment="connection 1" ];