I initially asked 3 questions in one email to the list.
Due to the large amount of information / responses, I have split
the summaries up into 3 separate entities.
Huge thanks and respect go out to all of the OSF-managers who
generously took the time to help. Thanks go to Erik Persson,
Larry Church, Subir Grewal, Barb Baker, Mikel Stous, Karl Marble,
alan_at_nabeth.cxo.dec.com, paw_at_northstar.dartmouth.edu and
Anil Khullar . I do hope I have not missed anyone out.
As others have mentioned, it is truly amazing how fast
replies / answers come in - OSF-managers is an awesome
list and this system of summaries (to keep traffic low)
is ideal.
Thanks again. (the original question and summary follow)
Chas
The original question was :
> I am coming to Digital Unix from a basic AIX background
> and have inherited some Alphas that seem to have strange
> configurations :
>
> 1) In AIX I would append shell commands to the /etc/rc.tcpip
> or /etc/rc.local files.
> OSF/1 has these /sbin/rc3.d , /sbin/rc0.d and
> /sbin/rc2.d directories full of scripts. But how
> did these get here ?
> eg.
> One of these (/sbin/rc3.d/S56httpd80) is for starting
> netscape webserver. If I no longer wish to use this,
> can I simply delete the file ?
>
> And if I wish to create a new one for say Apache
> webserver, how would I go about doing this ?
> Any pointers on this subject are much appreciated.
Bottomline :
I needed to educate myself on the system V way of doing things...
coming from a FreeBSD and AIX background. It is difficult
to summarize the System V file system so best to leave the
following descriptions / answers :
======= [Richard Eisenman wrote ] ===============================
Essentially, the /sbin/init.d directory contains the separate script
equivalent of rc.local, rc.tcpip, etc. The rc?.d directories contain
links to the /sbin/init.d scripts which are intended to be run at bootup.
The process can be rather complex. I'd recommend getting into the manuals
fairly extensively, however, for a quick look see, use 'man rc0', 'man
rc2', and 'man rc3'.
===== [Larry Church wrote ] =======================================
a) all the start-up/shut-down scripts live in /sbin/init.d
b) the entries in the /sbin/rc?.d (the number corresponds to the run
level) are
links to the scripts in /sbin/init.d with the following meaning:
1) the K means stop (or Kill) the S signifys Start
2) the number is the order in which the scripts are executed (i.e.,
the S95xdm script (start xdm) is executed before S96httpd (start
the httpd server).
c) to start the appache web server, edit the /sbin/init.d/httpd
start/kill
script to point ot your web server.
===== [ Mikel Stous basically walked me through the webserver startup
scripts which provided a nice example ] ==========================
> One of these (/sbin/rc3.d/S56httpd80) is for starting
> netscape webserver. If I no longer wish to use this,
> can I simply delete the file ?
Yes, it will only delete it from the startup. Usually this
is a hard or soft link to a file in /sbin/init.d/ so it's OK
to delete.
>
> And if I wish to create a new one for say Apache
> webserver, how would I go about doing this ?
> Any pointers on this subject are much appreciated.
Here's my /sbin/init.d/httpd file that I make a soft link to
from /sbin/rc3.d/S99httpd
-------------
#!/bin/sh
#
# Start up Apache http Deamon
#
cd /usr/local/etc/httpd
case "$1" in
'start')
./start
;;
'stop')
./stop
;;
'reload')
./reload
;;
*)
echo "Usage: /sbin/init.d/httpd { start | stop | reload }"
;;
esac
exit 0
------------
I also make a link /sbin/rc2.d/K00httpd to /sbin/init.d/httpd
also /sbin/rc0.d/K00httpd to /sbin/init.d/httpd
========= [Subir Grewal wrote ] =============================
This is not strange, this is true on almost all System V based Unixes (or
is it BSD). Solaris, Digital Unix, etc. have many different
initialization states. Buy, and read, 'Essential System Administration",
from O'Rielly, which goes through all of this.
======= [ Barb Baker so kindly sent me the following which really helped
]=====
D-Unix Alpha Startup Procedures
The proper method for adding commands/procedures into the system startup
is as follows:
1. Create a separate shell script in the /sbin/init.d directory with a
unique identifiable name. The script should accept the parameters
"start" and "stop" to perform startup and shutdown operations. For
example, to start the application barb,
create a startup script called /sbin/init.d/barb
chown bin /sbin/init.d/barb
chmod 750 /sbin/init.d/barb
2. Create a symbolic link to that shell script in the /sbin/rcX.d
directory where X is the run level at which the process should be
started. (Almost always level 3 for layered software). The link should
be named with the "Snn" + script name, where nn is a 2 digit number that
determines the order in which it will be executed based on the lexical
order (e.g., "S99myapp" will be executed last).
ln -s /sbin/init.d/barb /sbin/rc3.d/S25barb
(ln link to a file. -s symbolic link)
3. Create a symbolic link with the "Knn" prefix in each of the
/sbin/rcX.d directories, where X is the run level where this process
should NOT be running.
ln -s /sbin/init.d/barb /sbin/rc0.d/K01barb
ln -s /sbin/init.d/barb /sbin/rc2.d/K01barb
Detailed Description:
/sbin/rcN.d contains all the scripts associated with run level N. In
reality, the scripts are symbolic links that point back to files in
/sbin/init.d
Scripts in /sbin/rcN.d that start with a K are called with an argument of
"stop"; scripts in /sbin/rcN.d that start with an S are called with an
argument of "start". Kill scripts are run before start scripts.
Kill links are named KNcommand
K=kill
scripts are run in order of N
command=name of original script in /sbin/init.d
Startup links are named SNcommand
S=start
scripts are run in order of N
command=name of original script in /sbin/init.d
e.g., /sbin/rc2.d/S60lp is a symbolic link to /sbin/init.d/lp started at
run level 2. It's order is 60.
Run levels:
0 Specifies the halt state
1, S or s Specifies single-user mode
2 Specifies multiuser mode without network services
3 Specifies multiuser mode with network services
(s uses the same directory as run level 0)
====== [ Karl Marble summarized the same description ] ================
> One of these (/sbin/rc3.d/S56httpd80) is for starting
> netscape webserver. If I no longer wish to use this,
> can I simply delete the file ?
Absolutely...
> And if I wish to create a new one for say Apache
> webserver, how would I go about doing this ?
> Any pointers on this subject are much appreciated.
The rc[0,2,3].d directories contain scripts that are executed when you
change to that corresponding run level.
Run level 0 = halt
Run level 2 = multiuser w/o network services
Run level 3 = full blown multiuser & network services
Scripts that begin with 'S' are sent a 'start' argument ($1=start) when
entering that run level.
Scripts that begin with 'K' are sent a 'stop' argument ($1=stop) when
entering that run level.
The number after those letters dictates which get's executed first. The
lower the number, the sooner it gets executed when you change run states.
You can create one for apache, much like netscape. The script is just a
shell script...
========= [ as did paw_at_northstar.dartmouth.edu ]
===============================
The files in rcN.d are, if you'll notice, symlinks to files in
/sbin/init.d. If you don't want something to start up, you can remove the
link from rc3.d. If you know you'll never want it again, remove the file
from init.d. If you want to start something new, create a file in init.d
containing the script (notice that all of the scripts have cases for
'start' and 'stop'), and then make the link in the appropriate rc?.d. The
convention is that files beginning with S start things up, and those with
K
kill them (look in rc0.d); an S/K pair are merely two instances of the
same
file. Things are started or stopped in numeric order.
========== [ and so did Erik Persson ] ==================================
Whereas AIX (even in modern versions - I just don't see why) uses the
BSD model for the boot process using /etc/rc* files with lots of
commands in them most other modern Unixes (Digital Unix, HP-UX,
Solaris, Irix soem Linuxes and probably other) use the SysV init.
Basically the idea is that you keep all system startup scripts in
/sbin/init.d (like /sbin/init.d/nfs, which starts up NFS server
services on Digital Unix). Furthermore hese scripts accepts one
argument - "start" or "stop" and should return an error if none is
supplied.
In the /sbin/rc{1-6}.d you create symlinks to files in /sbini/init.d
with names like K23nfs or S56nfs. When a specific runlevel is entered
all files in the corresponding rc*.d directory is run - in
alphabetical order. The initial K or S says wether init shoud run the
script with the start or stop argument. The number gives an
opportunity to control the order in which the startup/shutdown scripts
are run. Another charming thing about this is that if you just remove
the symlink the script gets disabled - without having to be removed in
itself.
So, in order to create a startup script for Apache, you could take a
look at the various scripts in /sbin/init.d and build your own.
NeWT (Neuronet Web Team)
http://heaven.com.my - Channel X.
http://neuronet.com.my - Home.
Received on Sat Mar 29 1997 - 13:17:25 NZST