HP-UX System Administrator's Guide: Routine Management Tasks
# source the configuration file
if [ -f /etc/rc.config.d/web_productname]
then
. /etc/rc.config.d/web_productname
else
echo "ERROR: /etc/rc.config.d/web_productname MISSING"
fi
# Check to see if the web_productname daemon exists,
# is executable and should be started
if [ "$WEB_PRODUCTNAME" -eq 1 -a -x
"$WEB_PRODUCTNAMEHOME/$web_productname_daemon" ]
then
cd $WEB_PRODUCTNAMEHOME
./$web_productname_daemon
print "$web_productname_daemon started"
else
print "failed to start $web_productname_daemon"
rval=2
fi
;;
'stop')
killproc $web_productname_daemon
;;
*)
echo "usage: $0 {start|stop|start_msg|stop_msg}"
rval=1
;;
esac
exit $rval
Then create a configuration file, /etc/rc.config.d/web_productname, to
tell the above script where to find the web_productnamedaemon and whether
or not to start it up (1=yes; 0=no):
#!/sbin/sh#
# v1.0 web_productname startup/kill config
# WEB_PRODUCTNAME: Set to 1 to start
# web_productname_daemon
# WEB_PRODUCTNAMEHOME: home dir for web_productname
WEB_PRODUCTNAME=1
WEB_PRODUCTNAMEHOME=/sample/web_productname/binhp
Customizing Start-up and Shutdown 83