I have a script that exports the current config and then e-mails it to me. This script is called from the scheduler. In v3.13 everything worked fine. In v3.28 this stopped working. The script still works when run manually but no longer works when called from the scheduler. I see from that run count that the scheduler is in fact calling the scipt but for some reason the script never creates the backup file when called from the scheduler. Any ideas?
Does it send the email if run by the scheduler? Or does it fail completely.
In the scheduler, I use just the script name in the on-event entry. Like “on-event=ConfigExport”. The system scheduler knows to run it with the script interpreter.
maybe because the email is being sent before the exported file has been closed, therefore it does not send it? Try changing it two scheduled scripts, one minute apart, one to create the export, one to send it. See if it then works?
I know this is a stupid question, but does it have to be written via the CLI?
I had a huge amount of problem running and getting mine to work, but I ended using winbox and the scheduler and scripts in there, it worked pertectly
OK
Well look into Winbox CREATE THE FILE BACKUP
System>Scripts>Add.
Call Script : “backupscript”
Policy: Choose All
in the sourcebox type :
/system backup save name=xxxxx
// This of course can be anything you want it to be
Click Apply
Click Add again CREATE THE MAIL SCRIPT
Call Script : “mailscript”
Policy: Choose All
in the sourcebox type :
/tool e-mail send file=xxxxx.backup to=xxxx@xxxxxx.ie subject=[/system identity get name]
Click Apply
There you have your two scripts so now you need to make a schedule of these.
Again in Winbox CREATE THE SCHEDULE TO RUN THESE ABOVE SCRIPTS
System>Scheduler>Add
Name this one “Backup&MailScript”
The time and all that you can set yourself
In the OnEvents filed type
/system script run backupscript
/system script run mailscript
Set the Policies on that to all options and apply.
There you go, mine is currently sending me backups on a daily basics at 07:30 to my work mail account. I hope this helps