Hi There,
I need a little scripting advice.
So I created an import script which basically configures the Firewall , access lists , services , snmp , ntp , default password etc etc which works 100% but only under certain conditions So my technical guys will start off my updating to the latest firmware : 6.42.1(Stable) but they then have to "Reset the configuration" before the import script works properly... otherwise it will end up complaining about some missing items ... I'm guessing the default config that ships with the router is different then what you get when you reset the router to Default?
Anyway , after some troubleshooting I've realized that the following lines gets added when the router is defaulted. Well this and a bunch of other stuff changes but these two lines seems the only ones important to my issue
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
So normally this won't be an issue since it's a rather simple process , but every now and then our tech guys goes into retard mode and forgets to reset the router to default and also doesn't bother looking at the error which ends up in a poorly configured router.
So that said , I've been trying to add something in the script to check whether LAN or WAN is already added to the /interface list and if not to then add the missing values. So after reading through some scripting howtos I came up with the following code but I'm unable to get it to work. It basically needs to check whether the value is present and add it if missing. Problem is , I'm just getting an error "no such item" if it doesn't find the value which ends up with the (do) part not getting executed.
## Check whether interface exist , if no value is returned
:if ([/interface list get WAN] = "") do { /interface list add comment=defconf name=WAN }
Sorry for the long windy post , just wanted to make sure I've added as much info as possible.
thanks in advance,