Script Library

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.


server_uptime.s

Download

This script monitors an FTP server and sends an email if it is not accepting connections. Many cell-phone providers provide SMS text to email gateway servers that you can use to send a text message if the server is down. The outbound email configuration for "mail.local", including Server, Port, Protocol, From, and To are all set in the Outbound E-Mail section of the Configurator.


  1  SET mail_server = "mail.local"
  2  SET connected = "n/a" 
  3  FTPLOGON "ftp.mysite.com" /user="UserID" /pw="secret"
  4  IFERROR GOTO send_email
  5  SET connected = %datetime
  6  GOTO done 
  7  :send_email
  8  ;; If we reached this line we had max failures per cycle
  9  SET email_subject = "FTP site unreachable."
 10  SET email_body = "Robo-FTP has been unable to connect to the FTP site for at least 10 minutes.  "
 11  SET email_body = email_body + %crlf + %crlf + "Last successful connection: " + connected 
 12  EMAIL email_body /subject=email_subject /server=mail_server
 13  :done
 14  ;; Wait one hour (3600 seconds) between cycles
 15  PAUSE /for=3600
 16  GOTO start

Browse complete list of scripts