Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.
e-mail_daily_log.s
One of the benefits of Robo-FTP is the ability to create set-and-forget processes that notify you of results.
A typical workflow might look something like this:
- Perform a scheduled task (for this example we'll upload a certain file to a server every day).
- Create a daily log with the date in the file name showing what happened.
- E-mail the log file to whoever is responsible for monitoring this task.
To perform the scheduling you can use the built-in Robo-FTP Scheduler accessed in the Scheduling section of the Configurator.
1 ; Create a new log file every time the script runs.
2 ; The log will have the date in it like this:
3 ; daily_upload Oct 30 15.38.43 2007.log
4 ; The file name for the log will be stored in the
5 ; %currentlogfile script variable
6 log "daily_upload" /new
7 ftplogon "myuploadsite"
8 sendfile "file_to_be_uploaded.txt"
9 iferror goto send_error
10 set status = "SUCCESS"
11 goto done_sending
12 :send_error
13 set status = "FAILURE"
14 :done_sending
15 EMAIL "Daily upload results. See attached file for details." /subject=status /attach=%currentlogfile