I run a couple of scheduled scripts on my routers.
Script 1 runs at 0200 hrs and makes a backup file and an export file
Script 2 runs every hour throughout the day (0230, 0330 etc).
It checks for backup files and export files and upload them to an FTP server (NAS) using fetch, before deleting them on the router
When everything is up and running this works like a champ, but I would like to add some checking to my script, to be notified if something goes wrong.
I would like to verify that the file is actually uploaded to the FTP server, and - if possible - if it is of the right size.
1) Is it possible to get some sane result back from the fetch command?
I try to read the function result into a string:
Code: Select all
:set resstr [/tool fetch address=$ftphost src-path=$fname user=$ftpuser mode=ftp password=$ftppassword dst-path=($ftppath . $fname) upload=yes keep-result=yes];
:log info "Result= $resstr"
:log info ("Length=" . [len $resstr]);
However, if I change some params to provoke an error in the fetch command, i.e. invalid hostname, path, user, password or something, the script simply halts immediately.
Isn't it supposed to abort the fetch operation and return something useful as a function result?
2) Is it possible to browse the ftp server to check that the uploaded file(s) are present and of the right size?
Or is the only solution to try to pull the file off the ftp, save it to another name and compare the sizes?