Programming Service Scripts |
Top Previous Next |
A script file must be specified when running Robo-FTP as a service. Special considerations apply when programming a script to be used in a service:
Continuous looping A typical deployment of Robo-FTP as a service uses a script that runs in a continuous loop. One common design for service scripts uses either the CRON or PAUSE script commands to suspend processing and then later awaken to perform one or more tasks at a specified time or date. Once the task is complete, the script loops back and is suspended until the next period of activity.
Service scripts are also often designed for real-time processing so they are always looking for something to do. For example, the hot send and hot receive styles of service script constantly poll a folder for new files and then react accordingly when a new file is discovered.
Permissions File and folder permissions must be considered when which Windows account will be used to run the service. For example, the default built-in LOCAL SYSTEM account does not have access to network resources. Any account specified must have permission to log in as a service.
Error handling The IFERROR command is a powerful tool in service scripts designed for unattended execution. Use this command to catch and recover from potential failures including network outages and unexpected changes to login credentials or permissions. Many script developers choose to send an automated email message alerting support staff when an unrecoverable error occurs.
Important It is strongly recommended that you exhaustively test any script file that you intend to run as a service in the normal Robo-FTP console window before using it as a service.
Monitoring and logging Unlike other Windows services, the Robo-FTP service does not log all results and errors to the System Event Log. Instead, you should use the LOGMSG, DASHBOARDMSG, or LOGNTEVENT script commands to monitor operation of a Robo-FTP service. Do not use commands like ASK and PROMPT because interactive commands are not permitted in service scripts. If you plan to install the service from the command line then the script should include the SRVNAME command so that the Monitor utility can connect to it.
Logging is an importing tool for diagnosing problems with service scripts because they are typically run without the normal Robo-FTP console window interface. The LOG, TRACELOG and SESSIONLOG script commands are used to control logging.
Halting a service Typically a running Robo-FTP service will remain active until the script executes the EXIT command. A service may be stopped manually using the Windows Service Manager, the Service Installer or the Enterprise Dashboard.
If your script logic contains steps that must not be interrupted, you can design it to use a special shutdown script for orderly termination.
See also: Installing Robo-FTP as a Service |