Open System Services Management and Operations Guide (G06.29+, H06.07+)

Operating the OSS Environment
Open System Services Management and Operations Guide527191-005
2-28
Making OSS Application Processes Persistent with
the Kernel Subsystem
PROGRAM $SYSTEM.SYSTEM.OSH
ASSOCPROC $OSS2,
STARTUPMSG "-ls -p /bin/sh startmyapp reload"
c. Because the configuration uses a STARTMODE of MANUAL, you must enter
the following command at an SCF prompt to start the persistent process:
START PROCESS $ZZKRN.#OSSAPP
These commands configure and start the persistent process object OSSAPP in
processor 2, using the named process $OSH2 to launch the OSH utility. Then OSH
starts a login (-ls) shell (-p /bin/sh) that executes the script startmyapp and
passes the value reload to it.
startmyapp uses the OSS run command to start the program (-p) myapp as the
named process (-name) $OSS2. Because of the -ls flag, myapp inherits any
environment variables defined in either /etc/profile or $HOME/.profile for
the user ID OSS.APPS.
Once the SCF START command completes, the persistence manager monitors
both the $OSH2 and $OSS2 processes. If either process fails, the persistence
manager aborts the remaining process and makes up to five attempts to restart
$OSH2.
To stop the persistent process object, enter the following command at an SCF
prompt:
ABORT PROCESS $ZZKRN.#OSSAPP
This command stops both the $OSH2 and $OSS2 processes. $OSS2 is stopped
such that it does not create a zombie process.
3. Suppose the shell script with the filename launchmyapp must be run constantly in
each available processor because one of the tasks performed by launchmyapp
(starting an application program named myapp) needs to be done by a persistent
process. launchmyapp contains the following:
#! /bin/sh
#
PATH=.:/usr/ucb:/usr/bin:/bin;
export PATH;
CONFGURATION = $1;
#
run -name=/G/oss$ZCPU myapp $CONFIGURATION
where:
The value passed to myapp through the variable CONFIGURATION is supplied
as a command line parameter ($1) each time launchmyapp is invoked
The unique value used for the myapp process name consists of the base
character string "oss" and the number of the processor running the copy of the
child process, derived by appending the OSS environment variable $ZCPU to
the base string.