StorageWorks Command Console Agent in a TruCluster Environment Application Note

Application Note
EKSMA41AN. A01 Page 3
There are two major steps to creating an ASE Service. The two steps are:
1) create the start/stop scripts; and
2) create the service.
You can accomplish both the steps by running the asemgr and creating the start/stop scripts
inline. However, it is probably more practical to create the start/stop scripts first and then run the
asemgr to finish creating the service.
NOTE: When the ASE Director is started (for example during boot up) ASE
Services run the STOP scripts for all defined services by default. It
then runs the Start scripts for all defined services. When writing Start/Stop scripts,
one thing that should be apparent is scripts that toggle a programs run state
will exhibit strange behavior.
To create Start/Stop scripts outside of the asemgr utility use your favorite editor. The start script
should do what is necessary to start the program. The example illustrated below is included in the
Solutions CD. It can be found in /usr/opt/SWCC220/scripts after the Agent is installed.
/usr/opt/SWCC220/scripts/steamstart
#!/bin/sh
#
# Simple start script for steamd.
#
PATH=.:/etc:/bin:/usr/bin:/usr/ucb:/sbin
export PATH
SD="/usr/opt/SWCC220/bin/steamd"
grep -qsw steam /etc/inittab
if [ $? -ne 0 ]
then
echo "steam:3:respawn:$SD sF" >> /etc/inittab
init q
else
exit 0
fi
In the above example, the script checks for the existence of the key word steam in the /etc/inittab file.
If not found the steam start line is added. The init daemon is then sent the q option that tells it to
reload the inittab file and make any changes to the daemons operation.
Below is the example of the Stop script which is also located in the /usr/opt/SWCC220/scripts
directory. Once again the keyword steam is searched for and if found the stream editor sed is
invoked to remove it. The init daemon is then sent the q option to reload the inittab file. Since the
steam line has been removed, initd will kill the steamd program.
/usr/opt/SWCC220/scripts/steamstop
#!/bin/sh
#
# Simple stop script for steamd.