add name=backup policy=ftp,reboot,read,write,policy,test,winbox,password,sniff source=":log info \"backup beginning now\"\r\
\n:global backupfile ([/system identity get name] . \"-\" . [/system clock get time])\r\
\n/system backup save name=\$backupfile\r\
\n:log info \"backup pausing for 15s\"\r\
\n:delay 15s\r\
\n:log info \"backup being emailed\"\r\
\n/tool e-mail send tls=yes to=\"xxx@gmail.com\" subject=([/system identity get name] . \\\r\
\n\" Backup\") from=ROUTER@mt.com file=\$backupfile server=xx.xx.xx.xx\r\
\n:log info \"backup finished\""
xx is router IP.
When I run the script it create a backup file but it doesn’t send e-mail. It said Error sending mail: error connecting to server. What am I doing wrong and what am I missing? ROS is 4.17.
Can anyone help me?
:log info "backup beginning now"
:local Date ([:pick [/system clock get date] 7 11] . "-" \
. [:pick [/system clock get date] 0 3] . "-" \
. [:pick [/system clock get date] 4 6])
:global backupfile ([/system identity get name] . "-" . $Date )
/system backup save name=$backupfile
:log info "backup pausing for 15s"
:delay 15s
:log info "backup being emailed"
/tool e-mail send to="xxx@gmail.com" subject=([/system identity get name] . \
" Backup") from=xxx@gmail.com file=$backupfile server=[:resolve smtp.gmail.com]
:log info "backup finished"
587 port is set in tools email, username and password is also set.
Now, it said Error sending mail: error handling file. What am I doing wrong and what am I missing? ROS is 4.17.
Blank mail sent without trouble and it’s working on ROS 3.30 perfectly
Yes… I tried with tls= yes and I also get all the same. And tls should be on by default as I remember correct?
This looks like some kind of bug in ROS 4 since it works in 3.
api part is not available in 4.17. Without it, it’s ok but it have error when run, invalid FROM address.
hmmm… guess I’ll have to upgrade on ROS 5.1 or to downgrade to 3.30 if I want to make this work that way…
So, is it possible to make this script or my to work on 4.17?
All I noticed over time is that many times when MT comes with ROS upgrades the scrip language is changed here or there a little bit as well. Very irritating. You never know what works and each time you have to find out yourself how it is done this time…
Put the script line by line in terminal screen and you’ll see where the errors come up. Then start to try finding the proper format for making the script…
Start by using scripts, scheduler etc. with all policies enabled. After the script than works you can narrow the policies it has to work for by disabling the ones that should not be enabled.
put all parameters in quotes. The backup file name is probably causing issues on the send email line, quote them and see if that helps. also, the policy refers to the permissions on the script, check all those boxes to allow it access on the scheduler/script.
Good thinking… it worked. I placed [ ] on $backupfile and it worked. So, this one is working on gmail with port 587. Make note that simply get date WON’T WORK because of format printout (year/month/day) format. It needs to be (year-month-day) and you can play with a script and change sequence
:log info “backup beginning now”
:local Date ([:pick [/system clock get date] 7 11] . “-”
. [:pick [/system clock get date] 0 3] . “-”
. [:pick [/system clock get date] 4 6])
:global backupfile ([/system identity get name] . “-” . $Date )
/system backup save name=$backupfile
:log info “backup pausing for 15s”
:delay 15s
:log info “backup being emailed”
/tool e-mail send to=“> xxx@gmail.com> " subject=([/system identity get name] .
" Backup”) from=> xxx@gmail.com > file=[$backupfile] server=[:resolve smtp.gmail.com] tls= yes
:log info “backup finished”
this is my script all works but want to add a delay between emails sent
so in other words for foreach i i need
send email delay 00:00:10 then next value of i
then send again etc
as it thells me to many smtp connections to that server