I have no experience with Mikrotik scripting.
This works from terminal but not as a script:
/system/ssh address=192.168.240.9 user=dprnic command="[/interface/wireguard/peers/add interface=wireguard_users public-key=\"X7ZcanAGeG+G7/rZWDV4RoZ8vohzaUW9pdqEfkdiFRw=\" allowed-address=192.168.254.130]"
More info:
I am sending SMS with this message:
:cmd M script add_wg_peer publickey="X7ZcanAGeG+G7/rZWDV4RoZ8vohzaUW9pdqEfkdiFRw=" ip=192.168.254.130
This is a script:
{
:global ip;
:global publickey;
/system/ssh address=192.168.240.9 user=dprnic command="/interface/wireguard/peers/add interface=wireguard_users public-key=\"$publickey\" allowed-address=$ip;";
}
Can anyone see what is the problem, please?