Rtshell Script Writers Bible

Warning - Script writing and script use should be considered an exercise left to experienced users, those who are familiar with the normal operations of the telescopes and instruments. Please feel free to ask Ted about the workability of specific scripts. Also note comment below about difficulty in terminating scripts.

Rtshell was created by Ted Groner to address several limitations of the long-gone cominterp program. One major limitation was the lack of scripting. Rtshell implements scripting.

Scripts allow files to be sourced to control the following classes of functions:

How to run scripts

Scripts MUST only be sourced, not run as shell scripts! Since the rtshell maps in shared memory with the other programs which comprise the Realtime System, invoking a sub-shell of rtshell is an error. Rtshell should only be started with the rest of the system. Other scripts run by rtshell won't know about telescope or other built in commands!

The correct way to run a script, for example a script named my.script, is "source my.script" Adding arguments to invocation will be discussed below.

Writing Scripts

Use your favorite editor (emacs, vi, mg, etc) to create a file. The observer area has a subdir named scripts, designed to hold rtshell script files. This would be a good place to store your script. So, if using vi, the command for observer would be "vi ~/scripts/my.script". Insert your script commands int his file, save the file. In the rtshell window type "source ~/scripts/my.script". This should run the script.

Script Commands

Unix commands can be split into two group when using any shell. These commands are considered either "built in" or "system". With built in commands, the commands are part of the shell itself. With system commands, the shell executes the command in another process.

All instrument control and telescope movement commands are built into the rtshell. Some other commands were already built into tcsh, like "pwd". This document will only attempt to cover the commands that were added as built ins to the tcsh shell. Please consult man pages for tcsh(1) and csh(1) for more information about built in commands. Tcsh is a superset of csh, rtshell is a superset of tcsh. All other "system" commands are beyond the scope of this document as well.

Instrument Control Commands

This set of commands control the state of the detector. Which commands you wish to use depends on what instrument is mounted. Possible choices include 4shooter, echelle, fast and stelircam. Please consult the documentation for the instrument of interest.

Of special interest to this discussion are the commands "total, go, bias, flat, dark, and comp". These commands all instruct the instrument to expose for a period of time. They were designed to work from the rtshell window, and to return control of the window back to the observer after starting the exposure. This is NOT what is needed in a script. For this reason a special instrument command was created only for use in script files. This command is "gowait"

The gowait command is fully implemented for onlt the fast and ccd programs. It should soon be in use for echelle and sonic. I will use the ccd as an example.

The gowait command for the ccd (and fast) takes the form of:

The complete list of possible commands becomes

BEWARE OF "ccd gowait" with NO arguments! This starts an infinite exposure, which never returns!

Telescope Control Commands

The telescope control commands all have the common prefix "tele". Not all commands work on all telescopes, as the hardware differs. First we'll list commands good on both the 60" and 48".

Common Commands

tele coords -- valid commands are:

tele enable

48" ONLY Commands

60" ONLY Commands

OTHER COMMANDS

Putting it all Together

Most people learn best from example, so here are several!

KILLING A SCRIPT

It is not easy to kill a script, for the shell is occupied during the script and will not accept commands like "kill". Typing CNTRL-C during readout will sometimes kill each exposure individually, and thus is useful if there are only a few exposures left. Otherwise, you must kill the rtshell window (using a mouse button to bring up "Destroy Window"), and then restart the Realtime system. This problem may be avoided by putting in 5 second delays between each sequenced exposure in the script used, during which time one can type a CNTRL-C which will kill the sequence. The standard star and dome flat scripts above have such a feature. You may wish to copy this feature in your scripts.
Back to General Software home page.
Written by Ted Groner Modified last on 05/21/2001 TG