|Powered by QM on a Rpi server|
KnowledgeBase 00059: System Startup Scripts
This article was originally published as a Tip of the Week.
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=commandFor 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 passwordin 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
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.
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.
STARTUP=PHANTOM command; account username password