KnowledgeBase 00059: System Startup Scripts

QM provides a facility whereby one or more commands can be executed
automatically when QM is started. This is typically used to launch phantom
processes that must be present at all times.

The STARTUP Configuration Parameter

The QM configuration parameters file may contain lines of the form

STARTUP=command

For each such line, QM will execute the command as part of the startup
sequence. Where multiple STARTUP parameters are present, the order in which
they run is not guaranteed.

By default, the command is executed in the QMSYS account and as the SYSTEM user
on Windows or as root on Linux.
This may be undesireable, giving the process too great an access level. The
STARTUP parameter can be extended to be

STARTUP=command; account username password

in which case the command is executed in the named account and as the
specified user.

A process started by STARTUP will have the @TTY system variable set to
"startup". This can be tested in paragraphs (e.g. the LOGIN paragraph) by a
command such as

IF = 'startup' THEN STOP

Improving Security

Because the QM configuration parameters file is usually readable by all users,
it is not a good idea to include a plain text password in the STARTUP
parameter. Instead, the password can be encrypted using the AUTHKEY command
and the encrypted form prefixed with ENCR: used in the STARTUP parameter.

Persistent Processes

If the command executed by the STARTUP parameter will run for a long time, it
may be best to use STARTUP to launch a phantom process.