HP-UX 10.20/11.0
On HP-UX 10.20 and up, you do not modify the startup shell script. Instead, you need to create a number of files. The HP-UX documentation states that the following characters cannot be used as part of the file names: [.,~#]. Otherwise, you can choose any name for these files, as long as the names are consistent throughout the process. In our example, we use qedit_server.
You first need to create a control file in /etc/rc.config.d. This file sets a control variable that will be checked by the startup script. If the control variable is set to 1, the server will start; if it is not equal to 1, the server will not start. We will use QEDIT_SERVER as our variable name. The /etc/rc.config.d/qedit_server control file will now contain the following:
# ****** File: /etc/rc.config.d/qedit_server ******
# Qedit for Windows server configuration.
#
# QEDIT_SERVER: Set to 1 to start
# Qedit for Windows server
QEDIT_SERVER=1
Next, you need a shell script that will actually start the server. You can copy a template of the shell script from /sbin/init.d/template.
cd /sbin/init.d
cp template qedit_server
Modify the file so that it contains the necessary commands to start the server. You have to change all occurrences of CONTROL_VARIABLE to the variable name you used in the control file (i.e., QEDIT_SERVER).
You also need the execute command for the server program. Insert this command (underlined below) in the section after the 'start') string. The section looks like this:
'start')
# source the system configuration variables
if [ -f /etc/rc.config ] ; then
. /etc/rc.config
else
echo "ERROR: /etc/rc.config defaults file MISSING"
fi
# Check to see if this script is allowed to run...
if [ "$QEDIT_SERVER" != 1 ]; then
rval=2
else
# Execute the commands to start your subsystem
/opt/robelle/bin/qedit -d
fi
;;
Finally, you need a symbolic link to specify when the script in /sbin/init.d will be executed at boot time. Typically, you would start the server as the last step at run level 3. Get a list of all the startup files in /sbin/rc3.d with
ls /sbin/rc3.d/S*
Link names in this directory follow a set of conventions. The names start with the letter S or K. S links are startup scripts; K links are shutdown or "kill" scripts. The next three characters in the name represent an execution sequence number. This number must be 3 digits, and its value should be a number greater than the highest value on the ls listing. For example, if the last link is called S100nfs.server, you could use S111qedit_server. Create the symbolic link with
ln -s /sbin/init.d/qedit_server /sbin/rc3.d/S111qedit_server
For the time being, you do not need a "kill" link.