RABL3

Remote Administration Batch Language Version 3
Using RABL
3

 

A Typical Administration Problem

The diagram above illustrates a network controlled by a single administrator.  Let us suppose the administrator is based in London, ‘Area1’ is South East England, ‘Area2’ is North East England and ‘Area3’ is Paris, France.  Let us also suppose that the workstations are information terminals that display sponsorship advertising and train timetables.  A typical problem is that advertising files need regular updates and various other files need changing from time to time on each station.  It is both financially and logistically impractical to manually visit each terminal and update the files from a CD or other removable media each week.  On first sight the Network Administrator may opt to assign a static IP address to each terminal and use a remote administration package to carry out the file updates, this works fine in the above as there are only six terminals, however, this approach would become costly and time consuming if the network was to grow and what happens in the situations where the terminal cannot be assigned a static IP?

 

The RABL3 solution overcomes all of the above issues using the following approach;

 

  1. Each terminal can have dynamic IP as their location is not important to the RABL3 script,
  2. Each terminal has access to the internet via a modem, ADSL or networked connection,
  3. The FTP has a name that can be resolved from any computer with internet access. 

 

RABL3 takes care of the updates now automatically by finding the RABL3 Script on the server, downloading it and carrying out the instructions.  Now the network administrator has only to post a script and the new files to one location, all the hard work is done by the RABL3 engine.

 

In the example above we have identified three distinct areas and six distinct terminals, but network size is not important.  Each Workstation could represent a group of terminals so that for Area2, Workstation4 could represent 10 terminals named Workstation4a to Workstation4j, the single RABL3 script will work fine, and be able to carry out terminal specific downloads and uploads.

 

Let us examine what we may need to do with this Wide Area Network of terminals on a weekly basis.  A simple scenario is this:

 

  1. Collect the usage logs for each terminal and store them, named and date stamped, in a log folder on the server
  2. Collect the error logs for each terminal and store them, named and date stamped, in an error log folder on the server
  3. Publish new global adverts to all the terminals
  4. Publish regional specific adverts to terminal groups
  5. Publish site specific adverts to individual terminals

 

This is easy with a single RABL3 script!

 

Before building the script a little house keeping is required on the server; we must make the folders into which the logs will be stored, of cause this is a weekly event so they already exist but we may want to empty the folders to save our web space.  Next we need to post all the files that are going to be distributed to the server.  How these files are organised on the server is completely up to the administrator’s preference, we can specify their locations later in the script.

 

Now we can build the script, we start with the header to identify the file as a version 3 RABL script by using:

 

            #RABL3

 

The first task was to collect the two log files from each machine, we do this with:

 

      CWD ../usage

      SLP C:\logs

      PUT !LP!\usage.log>!ME!_!DT!usage.log

      CWD ../errors

      PUT !LP!\error.log>!ME!_!DT!error.log

 

Here we have assumed that both logs are stored locally in folder C:\logs and are to be stored on the FTP server in directories ../usage and ../errors.  We also assume that the date is 12th November 2004.

 

For Workstation1 RABL would upload file C:\logs\usage.log to ../usage as Workstation1_20041112usage.log and C:\logs\error.log to ../errors as Workstation1_20041111error.log, this is because we have included the two system variables !ME! and !DT!, !ME! is the unique local name of the script engine and !DT! is the date which is returned formatted yyyymmdd.

 

We have used five lines of code to collect twelve log files, if we had a network of a thousand terminals the same five lines would have collected two thousand files, this is a scalability and simplicity of RABL3!

 

Now we have to distribute the three sets of adverts, this is where the ability to group engines and identify each one individually really shows its strength.  We can distribute the global advert using:

 

      CWD ../newads

      SLP C:\Ad Files

      GET MainSponsor.swf>!LP!\MainSponsor.swf

 

In this example we are assuming that the terminals are running the CyberD Advertising Engine and are displaying Macromedia®Flash files as adverts, in this case MainSponsor.swf needed to be updated and that file name exists in the AdsList.ads for the Advertising Engine, of cause if the AdsList.ads file needed updating we would include

 

            GET AdsList.ads>!LP!\AdsList.ads

 

Now we have downloaded to all the terminals the new advertising movie to the C:\Ad Files folder, it is time to download the group adverts for the three areas using FUS..EFR as follows:

 

      FUS !AREA1!

      GET Sponsor1.swf>!LP!\Advert1.swf

      EFR

      FUS !AREA3!

      GET AdsList3.ads>!LP!\AdsList.ads

      GET Sponsor6.swf>!LP!\Advert9.swf

      GET Sponsor7.swf>!LP!\Advert10.swf

EFR

 

In this example Area2 did not require to be changed, Area1 required a one updated advert with no changes to the list and Area3 required two new adverts and an update list for the Advertising Engine.  These eight lines of code has updated four terminals in two countries with different files, using a remote administration package this would have meant opening a connection each machine and manually distributing the files, of cause if Area3 contained a thousand terminals this would have meant opening a thousand connections and distributing 3000 files, with RABL3 the last five lines of code would have done this automatically over all one thousand units.

 

If all the areas required Advert1.swf updating we could have posted to the server AREA1.swf, AREA2.swf and AREA3.swf then used a global update as shown below:

 

            GET !US!.swf>!LP!\Advert1.swf

 

Here we use the !US! system variable to indicate AREA1, AREA2 and AREA3.

 

Finally we have two more adverts to send, one update to Workstation2 and one new advert to Workstation5, we do this as follows using the FOR..EFR command:

 

FOR !Workstation2!

GET Advert128.swf>!LP!\Advert6.swf

EFR

FOR !Workstation5!

GET AdsList5.ads>!LP!\AdsList.ads

GET Advert129.swf>!LP!\Advert129.swf

EFR

 

The new files have now been distributed to the individual terminals so we can close the script with

 

#END

 

All RABL3 Scripts must end with #END

 


The complete script now looks like this:

 

 

#RABL3

      CWD ../usage

      SLP C:\logs

      PUT !LP!\usage.log>!ME!_!DT!usage.log

      CWD ../errors

      PUT !LP!\error.log>!ME!_!DT!error.log

      CWD ../newads

      SLP C:\Ad Files

      GET MainSponsor.swf>!LP!\MainSponsor.swf

      FUS !AREA1!

      GET Sponsor1.swf>!LP!\Advert1.swf

      EFR

      FUS !AREA3!

      GET AdsList3.ads>!LP!\AdsList.ads

      GET Sponsor6.swf>!LP!\Advert9.swf

      GET Sponsor7.swf>!LP!\Advert10.swf

EFR

FOR !Workstation2!

GET Advert128.swf>!LP!\Advert6.swf

EFR

FOR !Workstation5!

GET AdsList5.ads>!LP!\AdsList.ads

GET Advert129.swf>!LP!\Advert129.swf

EFR

#END

 

 

These twenty five lines of code will work for the six terminals illustrated in this example but would work equally as well if the network contained six thousand terminals.


Setting Up RABL
3 Script Engine on client PCs

 

Environment variables must be set up before the script engine can run; this is done using the RABL3 Settings Panel from the Windows Start Bar.

 

 

FTP Server

This is the name of the server which is used to store the RABL3 script and the files for downloading to the client PCs.  It is also where all uploads from the clients will be placed.

 

Username and Password

These are the username and password for the FTP account on the FTP server RABL3 is to sign in as.

 

FTP Directory

This is the path to the directory on the FTP server where the RABL3 engine will download the RABL Script for processing.

 

Script Name

This is the file name of the script that the engine is to download and process.

 

Local Engine ID

A unique name given to the engine to identify it on your network.

 

Group ID

The name of the group of clients that the engine is a part of.

 

Default Local Path

This is the default path used by the RABL3 engine for the system variable !LP! (q.v.), if left blank this will be the application path of the script engine.


 

RABL3 Command Set and Syntax

 

RABL3 scripts must include the header #RABL3 and the footer #END.

 

 

Commands (currently implemented)

 

CWD

 

                Change FTP Directory to expr1

 

                CWD expr1

 

      Notes:  to move back up the directory tree use CWD ..

            Example

To move from /public_html/updatefiles to /public_html/images

CWD ../images

 

 

SLP

 

                Set/change the local default path to expr1 at runtime without changing the $ENV_LOCAL_PATH

 

                SLP expr1

 

      Notes:   Sets the value of !LP! at runtime (q.v.)

Changing this value has no effect on the system variable, use SYS to change it permanently

 

 

GET

 

                Download file expr1 from server to expr2 on local machine.

 

                GET expr1>expr2

 

      Notes:   files on local machine will be overwritten.

                        expr2 must be the complete path e.g. C:\Advertising\Local Ads\New\Ad001.swf

expr1 & expr2 can include system values, q.v.

 

 

PUT

 

                Upload file expr1 from local machine to expr2 server.

 

                PUT expr1>expr2

 

      Notes:   files on server will be overwritten.

                        expr1 must be the complete path e.g. C:\Advertising\Local Ads\New\Ad001.swf

                        expr1 & expr2 can include system values, q.v.

 

DEL

 

                Delete file expr1 on local machine

 

                DEL expr1

 

      Notes: none

DED

 

                Delete directory expr1 on local machine

 

                DED expr1

 

      Notes: all files within the directory are destroyed.

 

MKD

 

                Make directory expr1 on local machine

 

                MKD expr1

 

      Notes: none

 

 

MOV

 

                Move file expr1 on local machine to file expr2 on local machine

 

                MOV expr1>expr2

 

      Notes: This command can be used to rename files.

 

 

CPY

 

                Copy file expr1 on local machine to file expr2 on local machine

 

                CPY expr1>expr2

 

      Notes: none

 

 

RUN

 

                Run application expr1 on local machine in window style expr2

 

                RUN expr1>expr2

 

      Notes:   RABL3 does not wait for the application to terminate.

 

Window Style

0 = hidden

1 = Normal with focus

2 = Minimized with focus

3 = Maximized with focus

4 = Normal without focus

6 = Minimized without focus

 

 

# (hash)

 

                Remark statement, also used to define script header and footer

 

                # download these files

 

      Notes: remarks are for human use and are ignored by the interpreter.

 

 

SYS

 

                Change RABL3 environment variable expr1 value to expr2

 

                SYS expr1>expr2

 

      Notes:   See system variables for names.

                        Changing these values has no effect until the next time the engine runs.

 

 

FOR … EFR

 

Only the engine specified by expr1, $ENV_LOCAL_NAME value, will execute commands nested in this command set.

 

                FOR !expr1!

            Commands…

      EFR

 

Notes:   The $ENV_LOCAL_NAME value is contained in !...! to identify it as a system variable.

                       

 

FUS … EFR

 

Only the engines specified by expr1, $ENV_GROUP_NAME value, will execute commands nested in this command set.

 

                FUS !expr1!

            Commands…

      EFR

 

Notes:   The $ENV_GROUP_NAME value is contained in !...! to identify it as a system variable.

 


System Variables

 

$ENV_FTP_SERVER                  Name of the FTP server

$ENV_FTP_USER                      Username for FTP connection

$ENV_FTP_PASS                      Password for FTP connection

$ENV_FTP_ROOT                      FTP directory where the RABL3 script is stored

$ENV_SCRIPT_NAME              Name of RABL3 script to download and execute

$ENV_LOCAL_NAME               Unique name of the local script engine (!ME!)

$ENV_GROUP_NAME               Group name of the local script engine (!US!)

$ENV_LOCAL_PATH         The default local path (!LP!), if unset this is the application folder of the script engine.

 

 

 

Using System Variable and Time/Date Identifiers

 

!ME!

The $ENV_LOCAL_NAME can be included into file names by using !ME!. This function is available in all commands.

 

Example

To upload C:\logs\errlog.log from engines named “PC01” & “PC02” without them overwriting each others log files use:

 

      PUT C:\logs\errlog.log>!ME!errlog.log

 

On the server you will now have PC01errlog.log & PC02errlog.log

 

 

!US!

The $ENV_GROUP_NAME can be included into file names by using !US!. This function is available in all commands.

 

Example

To download ScotlandAds.ads and EnglandAds.ads from the server as AdsList.ads for PCs grouped as England and Scotland us:

 

      GET !US!Ads.ads>AdsList.ads

 

This one line command removes the need to use FUS…EFR nesting for group downloads when all groups will download together, where only one group is to download (for example Scotland) use:

 

            FUS !Scotland!

      GET ScotlandAds.ads>C:\Adverts\AdsList.ads

EFR

            Or

            FUS !Scotland!

      GET !US!Ads.ads> C:\Adverts\AdsList.ads

EFR


!LP!

The $ENV_LOCAL_PATH can be included into file path names by using !LP!. This function is available in all commands.

 

Example

To download multiple files into the same directory use

 

            SLP C:\Adverts

      GET AdsList.ads>!LP!\AdsList.ads

      GET MyAd1.swf>!LP!\MyAd1.swf

      GET MyAd2.swf>!LP!\MyAd2.swf

 

 

!DT!

RABL3 can include the system date into file or path names by using !DT!. The date is formatted as an eight character string as yyyymmdd. This function is available in all commands.

 

Example

To upload a date stamped file use:

 

            SLP C:\logs

      PUT !LP!\usage.log>!DT!usage.log

 

 

!TM!

RABL3 can include the system time into file or path names by using !TM!. The time is formatted as a six character string as hhmmss. This function is available in all commands.

 

Example

To upload a time stamped file use:

 

            SLP C:\logs

      PUT !LP!\usage.log>!TM!usage.log

 

Combining Special Identifiers

 

The special identifiers can be used together to create such commands as:

 

      SLP C:\logs

      CWD ../!US!/!ME!

      PUT !LP!\usage.log>!DT!-!TM!usage.log

 


Example Script

 

Scripts can be created in Notepad or similar text editor software and uploaded to the FTP server as binary files.

 

 

#RABL3

 

SLP C:\Adverts

GET !US!.ads>!LP!\AdsList.ads

CWD ../ADS/!US!

 

# new SW group advert

FUS !SouthWest!

GET strongbow.swf>!LP!\sponsors\strongbow.swf

EFR

 

# update local advert at the saints ground

FOR !NorthamptonRUFC!

GET saints.swf>!LP!\saints.swf

EFR

 

# remove old advert

DEL !LP!\MUFC.swf

 

# post all error logs

CWD ../errorlogs/!US!

PUT C:\Logs\errlog.log>!ME!errlog.log

 

# moving the server tomorrow so reset system variables ready

SYS $ENV_FTP_SERVER>www.newftp.com

SYS $ENV_FTP_USER>myaccount

SYS $ENV_FTP_PASS>mypassword

 

# moving The Red Lion to The Green Dragon tomorrow

FOR !RedLion!

CWD ../logs/!US!

PUT C:\logs\usage.log>!ME!_usage.log

SYS $ENV_LOCAL_NAME>GreenDragon

MOV C:\logs\usage.log>C:\logs\oldusage.log

EFR

 

#END