p { margin-bottom: 0.08in; }
This procedure is commonly used on System 5 implementations such as SOLARIS, HPUX, AIX, LINUX.
Although this setup procedure will work on all Unix systems, care should be taken as to ascertain the native startup scheme for the OS you are working with. Usually the OS has a native interface to that aspect of it’s infrastructure :
HPUX =
SAM
AIX = SMITH
SOLARIS = SVC
LINUX = Determined by choice
of flavour and support applications.
In this exercise, we are using the OS independent Berkely setup. This setup uses the:
Script
depository directory /etc/init.d
The startup shutdown hierarchy
directrories /etc/rc.d/rc#.d
For illustration purposes, we will use a common feature application such as httpd.
Here is an example of the httpd startup script (see addenda 1) that is usually installed in the /etc/init.d directory when the webserver is installed. Sometimes, that startup scritp may be installed directly in the application directories. A link to the application startup script should be done from there if needed.
Notice that
the script has several parameters that are usually “start, stop,
restart, status, other…” this is common for a startup script.
Should you execute the command line :
/etc/init.d/httpd
stop
this would effectively
tell the script to execute the code that would stop the current
running httpd daemon and the access to the port 80 or other implied
would cease.
/etc/init.d/httpd
start
would restart it.
System 5
implementation use the
rc
and
rc.sysinit
system startup scripts that will read the /etc/rc.d directory
hierarchy and locate links that have the forme of
:
/etc/rc.d/rc3.d/S85httpd ->
../init.d/httpd and /etc/rc.d/rc3.d/K85httpd -> ../init.d/httpd
Notice the
S
and
K
at the beginning of the link and the
85
after it.
The
S
entry
in the rc3.d directory is there to tell the system to
Start
at sequence number
85
the script /etc/init.d/httpd after all other scripts in other
rc2.d,
rc1.d, rc0.d
have been executed.
The number
85
is arbitrary to the rc#.d directory and tells the
rc
script to start that numbered script after the lower numbers in that
directory have been dealt with. A
K
entry would tell the system to
kill the process and all other processes associated according to the
code in the startup script in the same manner.
So to startup the httpd daemon at system boot you would do this :
-
Install httpd as per instruction.
-
Make sure that the startup script “httpd” is present, available and executable, should have “ -rwxr-xr-x ” permissions 0755 with user root and group root.
-
Copy the httpd script in the /etc/init.d directory if not already there.
-
Execute the command find /etc -name “*http*” –ls to make sure that the S or K entries do not already exist.
-
Cd to /etc/rc.d/rc3.d
-
Use the command ln –s /etc/init.d/httpd S85httpd
-
It is wise to add a –s /etc/init.d/httpd K##httpd with a smaller number that the startup sequence to make sure that all associated files and dependencies are closed or stopped before starting a process.
-
At reboot, the system will start httpd after all preceding processes are done.
p { margin-bottom: 0.08in; }
Httpd startup script