Community discussions

MUM Europe 2020
 
sejtam
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 66
Joined: Sun Dec 14, 2014 4:23 pm

debugging scripting

Mon Jan 05, 2015 8:19 am

I have a script that runs fine from the commandline when logged in as 'admin'

when run from the scheduler, it doesn't seem to work:
0   name="sched_backup_email" owner="admin" policy=read,sensitive last-started=jan/05/2015 13:21:32 run-count=9 source=

       /export file=current_config hide-sensitive
       /tool e-mail send file=current_config.rsc to="my@email" body="See attached file" \
          subject="$[/system identity get name] $[/system clock get time] $[/system clock get date] configuration export"
The scheduler entry:
 0   name="sched_backup_email" start-date=jan/04/2015 start-time=13:21:32 interval=1d on-event=sched_backup_email owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive run-count=1
     next-run=jan/06 13:21:32

Nothing in the logs indicates why this did not run.

Is there any way to debug this, like having the system log what policy is missing for what operation? That would sure help figuring this out.
 
audiomation
just joined
Posts: 6
Joined: Mon Feb 09, 2015 7:05 am

Re: debugging scripting

Fri Feb 27, 2015 9:41 pm

Hi Sejtam,

Not sure if you've resolved your issue yet. I had the same issue with the scheduler - script would run from the terminal but not from the scheduler. I checked all the boxes for policy (permissions), then unchecked them one at a time to find out what I needed. It became clear that I needed 'test' to issue commands that didn't really seem to fit the 'test' description. I also needed 'policy' for reasons that weren't clear. Overall I find the documentation on this product to be abysmal, and not just the grammar/spelling. It's laid out in a less than useful fashion and is very incomplete. Too bad I like the product so much - its price/performance can't be beaten.

I am on a quest now to find a way to 'trace' my scripts as they run so I don't have to keep adding 'log info' statements everywhere to figure out what's going wrong. I've never seen such a powerful platform lack such a basic feature. Maybe I'll find it today - have looked before though. At least today I saw someone else asking the same question. Hopefully he got a good answer.
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4051
Joined: Wed May 11, 2011 6:08 pm

Re: debugging scripting

Fri Feb 27, 2015 10:01 pm

You could try putting your script into a text file and running it from the command line with the import utility - that will give you a line number with syntax error. If there are none, then you can create debugging commands such as log output, or setting comments on certain objects, etc.
When given a spoon,
you should not cling to your fork.
The soup will get cold.

Who is online

Users browsing this forum: No registered users and 19 guests