Community discussions

MikroTik App
 
5f382a3f
just joined
Topic Author
Posts: 4
Joined: Wed Apr 18, 2018 9:04 pm

Automatic Import Fails Silently

Wed Apr 18, 2018 9:10 pm

So I'm trying to debug a .auto.rsc script. If I scp it over to the router and then run the script with /import it works correctly. If I ftp put the script, it auto runs about half way through, and the log file generated only says 'this script has run successfully'. How am I supposed to debug a script that is failing if there are no logs of failure? RouterOS v6.39.2
 
2frogs
Forum Veteran
Forum Veteran
Posts: 713
Joined: Fri Dec 03, 2010 1:38 am

Re: Automatic Import Fails Silently

Wed Apr 18, 2018 9:58 pm

Add your own log output to the script.

:log “adding IP address”
/ip address
add ......

:log “adding IP DHCP-Client”
/ip dhcp dhcp-client
add .....

And so on.
 
User avatar
jspool
Member
Member
Posts: 469
Joined: Sun Oct 04, 2009 4:06 am
Location: Oregon

Re: Automatic Import Fails Silently

Wed Apr 18, 2018 10:06 pm

Does the script run as the ftp user that uploaded it? If so does the ftp user have the needed permissions to execute all aspects of the script?
 
5f382a3f
just joined
Topic Author
Posts: 4
Joined: Wed Apr 18, 2018 9:04 pm

Re: Automatic Import Fails Silently

Wed Apr 18, 2018 10:47 pm

Thanks for the suggestions.

Script appears to be running as admin based on logs. The :log trick is handy but doesn't seem to be giving me much more information than I can already infer based on what changes and what doesn't before/after script run. I notice in the wiki there is this:
:do {
      :put [:resolve www.example.com];
} on-error={ :put "resolver failed"};
:put "lala"
Any way to capture the error and log that rather than just a string?

Who is online

Users browsing this forum: No registered users and 26 guests