Script to email configuration backup
Posted: Thu Feb 18, 2010 8:38 am
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?
/system scheduler
add comment="" disabled=no interval=5m name="conf exp test" on-event=\
"/system script run \"Config Export\"" policy=\
reboot,read,write,policy,test,password,sniff,sensitive start-date=\
jan/01/1970 start-time=03:00:00
In brief:
/system script run "Config Export"
/system script
add name="Config Export" policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
/export file=daily_export\r\
\n/tool e-mail send to=\"me@here.org\" subject=([/system iden\
tity get name] . \" \" . [/system clock get time] . \" \" . [/system clock\
\_get date] . \" Export\") file=daily_export.rsc\r\
\n\r\
\n"
In brief:
/export file=daily_export
/tool e-mail send to="me@here.org" subject=([/system identity get name] . " " . [/system clock get time] . " " . [/system clock get date] . " Export") file=daily_export.rsc
/system scheduler
add comment="" disabled=no interval=5m name="conf exp test" on-event=\
"/system script run \"Config Export\"" policy=\
reboot,read,write,policy,test,password,sniff,sensitive start-date=\
jan/01/1970 start-time=03:00:00
In brief:
/system script run "Config Export"
/system script
add name="Config Export" policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
/export file=daily_export\r\
\n/tool e-mail send to=\"me@here.org\" subject=([/system iden\
tity get name] . \" \" . [/system clock get time] . \" \" . [/system clock\
\_get date] . \" Export\") file=daily_export.rsc\r\
\n\r\
\n"
In brief:
/export file=daily_export
/tool e-mail send to="me@here.org" subject=([/system identity get name] . " " . [/system clock get time] . " " . [/system clock get date] . " Export") file=daily_export.rsc