man8/SCRIPTmngr

Table of Contents

Name

SCRIPTmngr - script manager

Synopsis

SCRIPTmngr <argument list>

Description

This program is a general purpose script dispatch manager. It monitors a list of datapoints and when any datapoint in the list arrives at a preset value it invokes the program specified by script_path. Generally the invoked program is a shell script which can be used to dispatch other programs.

Arguments

Arguments are processed using Unix long argument syntax.
--mngr <fn>

The CONFLIST file from which to obtain the configuration information.

If this is not specified it defaults to "MNGRconf" in the current working directory (i.e. the directory where the program was started).

--mngr_pn <fn>

The program name to use when parsing the CONFLIST file.

If this argument is not specified it generally defaults to the program name.

--conf <fn>

The program to call when SCRIPTmngr is triggered by a valid event.

The program is called when a match in found in the value field in the corresponding MNGRconf entry.

The program is invoked as progname arg1 arg2 arg3 where arg1 is the group name, arg2 is the function name, arg3 is the index value from the CONFLIST used to configure the program.

--show_tbl

If this argument is present the contents of the CONFLIST table is printed to stderr
--diag

If this argument is present stdout and stdin are left open and the program may be killed by SIGINT.
--verbose=<n>

Normally the program does it’s work silently. This sets the level of logging information. The number is optional but if provided it must include the "=". If no argument is provided the default level is 1.

0 - work silently
1 - print signon msg, option settings

Configuration name usage

The configuration file uses the libmngr(3mngr) facility to connect internal parameters to the AccelNET database. The mappings for this program are given below.

Parameters needed by this program can be combined with parameters belonging to other programs. The "program name" field in the configuration file differentiates the entries.

SCRIPTmngr uses "SCRIPTmngr" as the program name when searching the file.

Configuration name usage is free form. Any combination of group, function and index may be used. It is probably good to avoid using the const* and file* functions. SCRIPTmngr will attempt to subscribe to all entries in the list.

Notes

The group and function names are passed as args to the program invoked by SCRIPTmngr used to be given as strings of the same form as the symbols in conf.h. rather than in the form used in the MNGRconf file.

For example: g1 --> CFG1, read1 --> CFread1.

This has now been changed so that the args are of the same form as used in the MNGRconf file. This causes breakage of the script file so this file must be repaired when upgrading. 9-9-04rlk.

Example MNGRconf file

#
# this example dispatches the script everytime
# the beamline select control (SETUP BLsel)
# is changed to a different beamline
#
#
# SCRIPTmngr service
#
SCRIPTmngr|g1|read1 |0|SETUP |BLsel |0.0
SCRIPTmngr|g1|read1 |1|SETUP |BLsel |1.0
SCRIPTmngr|g1|read1 |2|SETUP |BLsel |2.0
SCRIPTmngr|g1|read1 |3|SETUP |BLsel |3.0
SCRIPTmngr|g1|read1 |4|SETUP |BLsel |4.0
SCRIPTmngr|g1|read1 |5|SETUP |BLsel |5.0
SCRIPTmngr|g1|read1 |6|SETUP |BLsel |6.0

Example shell script

#!/bin/sh
#
#
#    dispatch program for SCRIPTmngr
#
#    arg1 - group name from MNGRconf
#    arg2 - function name from MNGRconf
#    arg3 - index value from MNGRconf
#
#    in this example we don’t parse the group name (g1)
#    because only one group is used
#
PROG=$USER_TREE/ubin/dbmod
DATA=$USER_TREE/$CONF/CmdFiles

case $2 in
read1)

case $3 in

0)                         # not used

;;

1)                         # TE beamline

echo "BM 02-1|Radius |0.9064" | $PROG $DBMAN_HOST

echo "BM TD-1|Radius |1.0350" | $PROG $DBMAN_HOST

;;

2)                         # TD beamline

echo "BM 02-1|Radius |0.9064" | $PROG $DBMAN_HOST

echo "BM TD-1|Radius |2.7730" | $PROG $DBMAN_HOST

;;

3)                         # TZ beamline

echo "BM 02-1|Radius |7.1892" | $PROG $DBMAN_HOST

;;

4)                         # TC beamline

echo "BM 02-1|Radius |7.1892" | $PROG $DBMAN_HOST

;;

5)                         # TB beamline

echo "BM 02-1|Radius |2.2940" | $PROG $DBMAN_HOST

;;

6)                         # TA beamline

echo "BM 02-1|Radius |1.1469" | $PROG $DBMAN_HOST

;;

esac

;;

esac

See Also

libmngr(3mngr)

Manual page revision

$Id: SCRIPTmngr.8,v 1.10 2008/08/11 13:10:19 kitchen Exp $


Table of Contents