On Wed, 17 Aug 2005, Andy Warner wrote:
jenlhunt2003 wrote:
> > Actually, putting
> >
> > tst1:12345:wait:/mydir/myprogram
> >
> > after the Run Level r6:6:wait:/etc/rc.d/rcS 6 line in etc/inittab
> > seems to work quite well so far, including network connectivity.
> >
> > So, since this approach isn't proper, how do you recommend handling
> > unattended bootup the "right" way? Seriously, not being able to boot
>
> Why isn't using inittab the "right" way ? init's only job is to
> run programs in an orderly manner. It's responsible for running
> getty so you can get a login prompt. Indirectly it's responsible
> for sshd/telnetd access too.
>
> Init deploys 2 mechanisms to run programs:
>
> /etc/inittab entries
>
> /etc/rc.d scripts
>
> placing a script (or a link to a script) in /etc/rc.d/rc<n>.d/
> will also ensure it is run with specific arguments (start|stop)
> when the system enters/leaves a given runlevel (it's slightly
> smarter than that - but that's the summary).
>
> You can use either method to get init to run your
> program, historically scripts are used to start
> daemons (inetd, lpd etc) and run complex config
> scripts (e.g. network config) - whereas inittab
> is used to run straightforward programs that need
> to be restarted (e.g. getty, X server etc)
>
> The specification you list will happily run myprogram in
> runlevels 1, 2, 3, 4 & 5 - which might not be what you want.
> You may only want to run it in 345 or even just 5. 1 & 2
> are before the system has gone multi-user and got the network
> up and running.
>
> Here is the secret decoder ring for the runlevels (not
> that secret, it's in a comment at the top of most inittabs):
>
> # 0 - halt (Do NOT set initdefault to this)
> # 1 - Single user mode
> # 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
> # 3 - Full multiuser mode
> # 4 - unused
> # 5 - X11
> # 6 - reboot (Do NOT set initdefault to this)
>
> You can also specify "respawn" instead of "wait" and init
> will restart the program whenever it exits instead of just
> running it once. Be warned that it will throttle how many
> times per second it runs the program - it does not expect
> the program to exit quickly.
>
> Ultimately, however you run the program, it can be traced
> back to init and /etc/initab or /etc/rc.d/* on most unmodified
> linux systems - I don't see mastering init as too much hassle.
> "man init" and "man inittab" are your friend.
Scripts in /etc/init.d (the usual system V initialise system directory,
it's a link I believe on the technologics setup) traditionally are invoked
with one of the parameters "start" "stop" "restart" or "status", which
means that you have a script to manually control your daemon application.
If you leave init controlling you app via an entry in inittab, you loose
this extra manual control. As Andy says straight forward programs use
inittab and more complex apps use an individual start up script.
Best way to make one of these scripts for a new app is to take an
existing one and modify it.
A google for
system V init description
gets lots of hits - it's well written up.
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12hi9qa98/M=362131.6882499.7825260.1510227/D=groups/S=1705005378:TM/Y=YAHOO/EXP=1124320036/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|