change ospf interface cost

how to change cost of interface via script ? I tried but don’t have any idea because when i try to change cost of interface i must before print list of interfaces and i don’t know how do this via script.

Look around the forum (and/or the docs) for the “find” command in scripting - you have to “find” an item in a script (by its’ comment or some indentifying parameter) to be able to use it in the script after that.

Regards,
Christian

thx, I find
add cost:
routing ospf interface add interface=ether1 cost=1

and remove:
routing ospf interface remove [find interface=ether1]

I must write scirpt ( in my opinion this is unrealizable):
ping to some IP address every minute
if ping OK → decrease the ospf interface cost about 1 (minimum for cost is 1)
if ping isn’t OK (we don’t ping our IP address) → increase the ospf interface cost about 1 (maximum for cost is 40)

in my opinion this is unrealizable

On the contrary, it’s very easy.
Search the docs/forum for the tool named ‘netwatch’. It can ping an IP address and run scripts depending on result. Then you’ll need two scripts: one which decreases cost and one that increases.