Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* rc3, init.d and starting things at bootime
@ 1999-05-06  4:00 Brandon Hutchison
  1999-05-06  4:00 ` Adam Price
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Brandon Hutchison @ 1999-05-06  4:00 UTC (permalink / raw)


I realise this is a pretty naive request but could somebody give me an 
overview of how I get to automatically start something eg a webserver or 
a licence server at boottime.

I've found this directory  /sbin/init.d which seems to contain scripts 
for starting things  and then there is the other one /sbin/rc3.d which 
seems to contain links to the previous one. The links are named in 
systematic ways starting with Snn....   where nn is a number.

Do the scripts need to be written in any special way..

The man pages on all this are pretty detailed and I sort of need an overview.

System: DEC Alphatstation running 4.0B DU.

Thanks for your help..





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rc3, init.d and starting things at bootime
  1999-05-06  4:00 rc3, init.d and starting things at bootime Brandon Hutchison
@ 1999-05-06  4:00 ` Adam Price
  1999-05-06  4:00 ` Christian Krackowizer
  1999-05-07  4:00 ` Oisin McGuinness
  2 siblings, 0 replies; 7+ messages in thread
From: Adam Price @ 1999-05-06  4:00 UTC (permalink / raw)



Brandon Hutchison wrote in message ...
>I realise this is a pretty naive request but could somebody give me an
>overview of how I get to automatically start something eg a webserver or
>a licence server at boottime.
>
>I've found this directory  /sbin/init.d which seems to contain scripts
>for starting things  and then there is the other one /sbin/rc3.d which
>seems to contain links to the previous one. The links are named in
>systematic ways starting with Snn....   where nn is a number.
>
>Do the scripts need to be written in any special way..
>
>The man pages on all this are pretty detailed and I sort of need an
overview.
>
>System: DEC Alphatstation running 4.0B DU.
>
>Thanks for your help..
>
>
Hi,
init reads the inittab at boot and runs /sbin/rc3 at startup this runs each
of the scripts named Sxxx in order (The order is ascii sort order, but
because all of the scripts start with Snn they seem to run in numeric order,
took me a while to realise why S100mystuff ran before S99stuff_i_depend_on)
with the argument start. Because the scripts may need to be run at different
run levels, it is good practice to put them in /sbin/init.d with a
meaningful name and then place a symbolic link in /sbin/rcX.d, where X is
the runlevel you want things to be started at.
Normally the scripts are written so that when called with start as an
argument they will start a service, and when called with stop as an argument
they will stop it, however there is nothing to stop you writing two scripts
to do this if you must.
The scripts with the K prefix are run with a stop argument at shutdown(bit
hazy here, may be on leaving the runlevel, long time since I looked)
So the simple answer is no you don't need to write your scripts any special
way, but if you do others may understand them better.
Take one of the scripts which is already there, and rip it to pieces, put
you own stop and start commands in the case statement, and don't forget
about that ordering.

Hope this helps
Adam








^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rc3, init.d and starting things at bootime
  1999-05-06  4:00 rc3, init.d and starting things at bootime Brandon Hutchison
  1999-05-06  4:00 ` Adam Price
@ 1999-05-06  4:00 ` Christian Krackowizer
  1999-05-06  4:00   ` Adam Price
  1999-05-07  4:00   ` Otis Gospodnetic
  1999-05-07  4:00 ` Oisin McGuinness
  2 siblings, 2 replies; 7+ messages in thread
From: Christian Krackowizer @ 1999-05-06  4:00 UTC (permalink / raw)


In article <Pine.OSF.3.91.990506120506.16334A-100000@civilaa.civil>, 
hutch@civil.canterbury.ac.nz says...
>
>I realise this is a pretty naive request but could somebody give me an 
>overview of how I get to automatically start something eg a webserver or 
>a licence server at boottime.
>
>I've found this directory  /sbin/init.d which seems to contain scripts 
>for starting things  and then there is the other one /sbin/rc3.d which 
>seems to contain links to the previous one. The links are named in 
>systematic ways starting with Snn....   where nn is a number.
>
>Do the scripts need to be written in any special way..
>
>The man pages on all this are pretty detailed and I sort of need an overview.
>
>System: DEC Alphatstation running 4.0B DU.
>
>Thanks for your help..
>

Hi,

forget about all this init.d, rc.2/3/n stuff. Just add an new (last) entry in 
/etc/inittab e.g.

own:23:wait:/etc/rc.myownstuff > blah blah

in this rc.myownstuff you can specify all you want to start.
This technique works on all systems with an inittab, regardless where the 
rc.2/3/n are located - don't fiddle in system directories!

regards

-- 
+-----------------------------------------------------------------+
| Krackowizer Christian               mailto:kra1@technodat.co.at |
| TECHNODAT                           Phone: ++43-(0)662-454944-0 |
| CAD/CAM - Systeme fuer Moebel GmbH  FAX:   ++43-(0)662-454944-9 |
| Jakob-Haringer-Strasse 6            http://www.technodat.co.at/ |
| A-5020 Salzburg / Austria                                       |
+-----------------------------------------------------------------+




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rc3, init.d and starting things at bootime
  1999-05-06  4:00 ` Christian Krackowizer
@ 1999-05-06  4:00   ` Adam Price
  1999-05-07  4:00   ` Otis Gospodnetic
  1 sibling, 0 replies; 7+ messages in thread
From: Adam Price @ 1999-05-06  4:00 UTC (permalink / raw)



Christian Krackowizer wrote in message
<925983413.245242@hpwp3.technodat.co.at>...
>
>Hi,
>
>forget about all this init.d, rc.2/3/n stuff. Just add an new (last) entry
in
>/etc/inittab e.g.
>
>own:23:wait:/etc/rc.myownstuff > blah blah
>
>in this rc.myownstuff you can specify all you want to start.
>This technique works on all systems with an inittab, regardless where the
>rc.2/3/n are located - don't fiddle in system directories!

Makes sense, but I usually advise newbies to steer away from inittab because
of the pain of rebuilding it when they break it.

Good advice anyway,
Adam






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rc3, init.d and starting things at bootime
  1999-05-06  4:00 ` Christian Krackowizer
  1999-05-06  4:00   ` Adam Price
@ 1999-05-07  4:00   ` Otis Gospodnetic
  1 sibling, 0 replies; 7+ messages in thread
From: Otis Gospodnetic @ 1999-05-07  4:00 UTC (permalink / raw)


In article <925983413.245242@hpwp3.technodat.co.at>,
  kra1@technodat.co.at (Christian Krackowizer) wrote:
> In article <Pine.OSF.3.91.990506120506.16334A-100000@civilaa.civil>,
> hutch@civil.canterbury.ac.nz says...
> >
> >I realise this is a pretty naive request but could somebody give me an
> >overview of how I get to automatically start something eg a webserver or
> >a licence server at boottime.
> >
> >I've found this directory  /sbin/init.d which seems to contain scripts
> >for starting things  and then there is the other one /sbin/rc3.d which
> >seems to contain links to the previous one. The links are named in
> >systematic ways starting with Snn....   where nn is a number.
> >
> >Do the scripts need to be written in any special way..
> >
> >The man pages on all this are pretty detailed and I sort of need an overview.
> >
> >System: DEC Alphatstation running 4.0B DU.
> >
> >Thanks for your help..
> >
>
> Hi,
>
> forget about all this init.d, rc.2/3/n stuff. Just add an new (last) entry in
> /etc/inittab e.g.
>
> own:23:wait:/etc/rc.myownstuff > blah blah
>
> in this rc.myownstuff you can specify all you want to start.
> This technique works on all systems with an inittab, regardless where the
> rc.2/3/n are located - don't fiddle in system directories!

Hi,

I'm not new to UNIX, but I'm relatively new to Alphas.
I'm not sure about which 'Action' I should specify for starting something like
Apache web server/httpd at boot time?
man page for inittab describes all actions, but a number of them seem okay to
me, so I'm not sure which one to use :)

Can anyone help? (maybe an entry from your /etc/inittab?)

Thanks,

Otis

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rc3, init.d and starting things at bootime
  1999-05-06  4:00 rc3, init.d and starting things at bootime Brandon Hutchison
  1999-05-06  4:00 ` Adam Price
  1999-05-06  4:00 ` Christian Krackowizer
@ 1999-05-07  4:00 ` Oisin McGuinness
  1999-05-07  4:00   ` Adam Price
  2 siblings, 1 reply; 7+ messages in thread
From: Oisin McGuinness @ 1999-05-07  4:00 UTC (permalink / raw)


You can read a quick and clear description of the roles of /etc/inittab
and the rc*.d directories
in section 4.1 of the "System Administration" guide, which can be found
at http://www.unix.digital.com/faqs/publications/base_doc/DOCUMENTATION/ 

I would strongly recommend against fiddling with /etc/inittab; it is too
crucial for
the system booting properly that you not get it wrong. But putting a bad
script
in the rc*.d is no big deal; it will just not start your programs right.

Here is the quick scoop on what to do:

1) Master copies of the start scripts are stored in /sbin/init.d (e.g.,
we have one
   called samba, for starting you know what.)

2) If you want your script to run in multiuser network mode (3), create
a link in
 /sbin/rc3.d to the script in /sbin/init.d. Again, for samba, we have
  ln -s /sbin/init.d/samba /sbin/rc3.d/S89samba

3) If you want your programs to do some cleanup, or shutdown properly
when the machine
  changes init state (e.g., to 2, s or 0), create a link in the correct
rc*.d directory,
  but named KxxName, where xx is a suitable number.

4) Script contents: Your script should be a /bin/sh script. When called
as a "S" script,
  it will be given a single parameter "start"; when called as a "K"
script, "stop".
  I *strongly* recommend reading those in /sbin/init.d supplied by
Digital; take one as
  a model, and adapt it. Some products (samba) come with sample "system
5" startup scripts;
  these are also usually adaptable.

5) The number given to the links in 2) and 3) determines the order of
execution; for "S"
   scripts higher numbered scripts are executed later; you probably
don't want, e.g., samba
   to run before networking is up and running.

6) If there are machine dependent parameters you need, use the model of
the Digital scripts,
   and use rcmgr calls in the start script to query /etc/rc.config.
E.g., we have
   SAMBASSERVER="yes"
   export SAMBASERVER
  lines in our /etc/rc.config files on machines where we run samba, and
the /sbin/init.d/samba
  script looks for this. Read the man page for rcmgr for more. This way
you can keep the same
  startup scripts on all your machines, and emulate Digital's machine
localizations.

7) I *strongly* recommend you compare the scripts used by Digital Unix
with those on SunOS (kept
   in /etc/init.d, /etc/rc*.d) if you want to contrast engineering
practices. I defy anyone to 
   explain the Sun networking startup scripts in a seminar lasting less
than a week! Note how uniform
   in style and how clear the Digital scripts are.

8) Major Gotcha: The program started by your startup scripts MUST handle
SIGHUP; either explicitly
  or by ignoring it; init will send 2 SIGHUPS to the process; typically
a signal to your daemon
  (your programs must be daemons) to read its config files.


Hope this helps

Oisin McGuinness
Sumitomo Bank Capital Markets
277 Park Avenue
New York NY 10172
USA
oisin@sbcm.com


Brandon Hutchison wrote:
> 
> I realise this is a pretty naive request but could somebody give me an
> overview of how I get to automatically start something eg a webserver or
> a licence server at boottime.
> 
> I've found this directory  /sbin/init.d which seems to contain scripts
> for starting things  and then there is the other one /sbin/rc3.d which
> seems to contain links to the previous one. The links are named in
> systematic ways starting with Snn....   where nn is a number.
> 
> Do the scripts need to be written in any special way..
> 
> The man pages on all this are pretty detailed and I sort of need an overview.
> 
> System: DEC Alphatstation running 4.0B DU.
> 
> Thanks for your help..



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: rc3, init.d and starting things at bootime
  1999-05-07  4:00 ` Oisin McGuinness
@ 1999-05-07  4:00   ` Adam Price
  0 siblings, 0 replies; 7+ messages in thread
From: Adam Price @ 1999-05-07  4:00 UTC (permalink / raw)



Oisin McGuinness wrote a good overview in message
<37331F14.E52D240B@sbcm.com>...
I cut it down...
>5) The number given to the links in
>2) and 3) determines the order of
>execution; for "S" scripts higher
>numbered scripts are executed later;
>you probably don't want, e.g., samba
>to run before networking is up and running.

This is true so long as the number is less than 100,
 the order is ASCII sort order, and this caused me
all sorts of problems until I twigged.
S100 will execute between S10 and S11 unless you
change them all.

Hope this helps
Adam
--
Please don't send me email.
If you must, then use the address as given, there is no spam-block.






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-05-07  4:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-05-06  4:00 rc3, init.d and starting things at bootime Brandon Hutchison
1999-05-06  4:00 ` Adam Price
1999-05-06  4:00 ` Christian Krackowizer
1999-05-06  4:00   ` Adam Price
1999-05-07  4:00   ` Otis Gospodnetic
1999-05-07  4:00 ` Oisin McGuinness
1999-05-07  4:00   ` Adam Price

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox