Scripting Policy Based Routing

I am looking to achieve something similar to the scripts listing a failover to a backup gateway using standard routing upon a netwatch condition being met. However, I am using Policy Based Routing and can’t seem to script changes in this command.

I basically want to enable or disable certain rules to redirect traffic: for example… /ip policy-routing rule enable 1 and of course, the opposite … /ip policy-routing rule disable 1

Both of these work from the shell, but nothing happens when I run the script. Also, I think it is possible to enable and disable items from scripts as when I enter… /interface ethernet disable ether1 …the command processes the change.

Many thanks in advance.

use the name of the entry or comment to change the status of this entry.
You can post your script, will check where exactly could be the mistake.

Edgars

If you try /ip policy-routing rule enable 1, before /ip policy-routing rule print than it won’t work…

For scripts its better to use sintax like this:

/ip policy-routing rule enable [/ip policy-routing rule find table=main]

Thanks guys, your advice did the trick. I’m still figuring out the requirements of scripting and sure appreciate the help. All the best to both of you.