Fault Tolerant Scripts

Top  Previous  Next

 

There are many things that must happen correctly for two computers to exchange files over a network. The Robo-FTP scripting language gives you several tools you can use to develop automation scripts that gracefully recover when something goes wrong.

 

Errors in Script

Suppose you need to create a PGP encrypted file and then delete the original unencrypted source file. Further suppose that if the encryption step fails for any reason then you should NOT delete the original file. The IFERROR command is useful for catching failed commands and branching execution to another section of the script that handles the error condition. The LOOPIF command is useful when the script logic requires a failed operation to be automatically retried a fixed number of times. Many developers choose to send an automated email message alerting support staff when an unrecoverable error occurs.

 

Tolerating Environmental Errors

An unexpected computer crash or network outage can leave a partially transferred file on your computer or on the remote server. The mere existence of an incomplete file can cause big trouble in some heavily automated systems. The TMPNAME command simplifies the process of outputting files to a temporary location and then moving them to their intended destination only if the transfer is successful. The FTPTMPNAME provides the same functionality for file uploads.

 

Sometimes it is important to perform a task once, and only once. This creates a problem when the computer is unexpectedly rebooted because simply restarting your automation scripts will perform all tasks again from the beginning. When developing scripts for use in this type of environment you can use the AUDITDB command to enable an auditing process that automatically prevents repeating certain tasks if they were completed successfully during a previous execution.

 

Using the TMPNAME, FTPTMPNAME and AUDITDB commands together allows a script to take full advantage of Robo-FTP's transactional features.

 

 

Related command(s): IFERROR, LOOPIF, AUDITDB, TMPNAME, FTPTMPNAME

See also: Simple Error Handling Example, Script File Result Codes, %lasterror