Scheduling File Transfers With Robo-FTP

Top  Previous  Next

 

One of the most useful features of Robo-FTP is the ability run a script that transfers files unattended at scheduled times. There are two basic approaches to achieve this result: (1) use the Windows Task Scheduler to launch Robo-FTP with a script that transfers a file and then exits or (2) use Robo-FTP's scheduling script commands to create a script that always runs but only transfers files at the times you specify.

 

Windows Task Scheduler

To use the Windows Task Scheduler to automate file transfers, write a script that moves your files and then closes Robo-FTP with the EXIT command. Open the Scheduled Tasks folder in the Control Panel and create a task that uses the appropriate command line switches to launch Robo-FTP and execute your script.

 

If you add the Robo-FTP program folder to your system's PATH environment variable you can create Scheduled Tasks that simply call the Robo-FTP.exe executable without the full installed file path. In the future when you transition to a new upgraded version of Robo-FTP in a side-by-side installation, you can avoid modifying the command lines of all of your Scheduled Tasks by simply updating the PATH environment variable. This technique is also useful if you launch Robo-FTP scripts from batch files. Your system must be rebooted before changes in the environment variables will be noticed by Scheduled Tasks.

 

A button on the Advanced tab of the System Properties form allows you to edit your Windows environment variables.  When you edit the PATH variable, be sure to use a semicolon character between the Robo-FTP installation folder and the other folder paths already listed.

ev

 

You won't need to specify the full path to Robo-FTP.exe after adding the Robo-FTP installation directory to your system's PATH environment variable:

STask

 

 

The Scheduling Script Commands

 

Scheduling operations within a script file are controlled by using either the PAUSE or CRON script commands.

 

The PAUSE command is the simplest method and is best suited for scheduling a one-time event. This command results in script execution being suspended for a fixed period of time (e.g., 60 minutes) or until a fixed time of day (e.g., 11PM). At the designated time, the script “wakes up” and performs a series of tasks (e.g., log on to an FTP site, send a file, and log off). If the tasks are to be repeated, the script would loop back to the PAUSE command and wait for the next designated time to arrive.

 

The CRON command provides much more complex scheduling. This command allows events like “every Tuesday and Thursday at 11PM”, “once a month at midnight of the 5th day”, “every 15 minutes on March 30”, etc., and any combination thereof to be scheduled. To make scheduling with the CRON command more simple, Robo-FTP includes the CronMaker scheduling utility. With CronMaker, you build the "crontab.txt" input file to the CRON command with a few mouse clicks. When the next CRON event triggers, the script “wakes up” and performs a series of tasks (e.g., log on to an FTP site, send a file, and log off). If the tasks are to be repeated, the script would loop back to the CRON command and wait for the next CRON event to trigger.

 

Launch Robo-FTP running a script with one or both of these commands and the scripted tasks will occur when you want them to.

 

Using the CRON Command - A Brief Overview

 

When scheduling task(s) with CRON, there are usually three discrete components that need to be created:

 

1.One or more scripts that perform the tasks you want done.
2.The event file used by the CRON command.
3.A simple “master” script which loops to execute the CRON command and to launch the script(s) that do the work.

 

To schedule tasks with CRON, the following step-by-step approach is suggested.

 

First, create and test the script(s) needed to perform the file transfer tasks at hand. It is important that you test that each script does what you want it to BEFORE subjecting them to a final scheduled environment.

 

Next use the CronMaker utility to create or edit the event schedule. This process creates an event file (normally named “crontab.txt” that is saved in Robo-FTP’s program files folder). This file is direct input for the CRON command.

 

To make this all work, launch Robo-FTP with the master script. The master script executes the CRON command which will in turn launch task specific scripts at the scheduled times and then loop back to await the occurrence of the next event.

 

The following is a sample master CRON script:

 

:loop

CRON ;; wait for scheduled event
PERFORM %nextcmd;; launch the task script
GOTO loop;; loop to wait for next event

 

There is a similar file named “CronMaster.s” provided with Robo-FTP in the Sample Scripts folder.

 

Scheduling Dependability When Running as a Windows Service

 

This scheduling capability is further enhanced by Robo-FTP’s ability to be installed and run as a Windows service. When running as a service, Robo-FTP starts when the system boots up and remains active all the time - you don’t need to remember to start it up every day.

 

Installing Robo-FTP as a Windows service is easy using the provided Service Installer utility. To perform scheduled operations, install Robo-FTP as a service using a suitable script that incorporates either or both of the PAUSE and CRON script commands.

 

Summary

 

The combination of Robo-FTP’s scheduling and Windows service capability is a powerful combination to make sure that your file transfers take place dependably when you want them to.

 

See also: Scheduling Script Operations