rc scriping: why init.d?

rc scriping: why init.d?

Post by Rich Gra » Fri, 04 Jul 2003 22:17:07



I'm cleaning up some rc scripts and have a few questions.

Q: Why put the start stop script in the init.d directory instead
just linking the rc#.d/S & K scripts straight back to a file
in the project's directory tree?  (One less system specific
file to add/remove at install/uninstall.)  Similary, for AIX,
(the only OS I have to support which does not seem to have
a flavor of SysV'ish rc scripting) why not have the inittab
entry point directly to a start script in the project's
directories instead installing/removing /etc/rc.project.

I think I know the answer department:

Q: Is there a way for an application to get notification when
shutdown is first invoked?  By default, humans typically get
a minute of grace to finish up.  It would be nice if our
scheduler knew that a shutdown was coming in nnn seconds.  It
could supspend dispatching new jobs and condition running jobs
to either finish up or get to a reasonable stopping point in
the alloted grace interval.

Any other pointers to rc scripting resources and/or tips
would be appreciated.

Cheers!
Rich  


http://www.plustechnologies.com

 
 
 

rc scriping: why init.d?

Post by M?ns Rullg? » Fri, 04 Jul 2003 22:31:04



> Q: Is there a way for an application to get notification when
> shutdown is first invoked?  By default, humans typically get
> a minute of grace to finish up.  It would be nice if our
> scheduler knew that a shutdown was coming in nnn seconds.  It
> could supspend dispatching new jobs and condition running jobs
> to either finish up or get to a reasonable stopping point in
> the alloted grace interval.

In most installations, all processes are sent the SIGTERM signal prior
to system shutdown.  After this, they are given some time (a few
seconds) to clean up.  Do you want something else?

--
M?ns Rullg?rd


 
 
 

rc scriping: why init.d?

Post by Rich Gra » Fri, 04 Jul 2003 23:24:23




> > Q: Is there a way for an application to get notification when
> > shutdown is first invoked?  By default, humans typically get
> > a minute of grace to finish up.  It would be nice if our
> > scheduler knew that a shutdown was coming in nnn seconds.  It
> > could supspend dispatching new jobs and condition running jobs
> > to either finish up or get to a reasonable stopping point in
> > the alloted grace interval.

> In most installations, all processes are sent the SIGTERM signal prior
> to system shutdown.  After this, they are given some time (a few
> seconds) to clean up.  Do you want something else?

> --
> M?ns Rullg?rd


Yes.  The killall behavior happens after the apps have had a
chance to be shutdown cleanly by rc scripts. (I presume that at
rc shutdown time, apps are expected to terminate in some short
number of seconds.)

What I'm looking for is some sort of 'heads up' prior to the
start of the actual shutdown process.   For example, on several
SV'ish systems, the admin can issue:

shutdown -y -g120 -i0

to put out a two minute warning to users, then take the system
to a halt after that interval elapses.  It would be nice if my app
could also get a two minute warning so as to have a less abrupt
shutdown.  I've never seen a hint of such, but figured why not
ask?

--
Rich

http://www.plustechnologies.com

 
 
 

rc scriping: why init.d?

Post by Andrew Gabri » Fri, 04 Jul 2003 23:33:02




Quote:> I'm cleaning up some rc scripts and have a few questions.

> Q: Why put the start stop script in the init.d directory instead

So the system admin can easily find it to run it by hand.

Quote:> just linking the rc#.d/S & K scripts straight back to a file
> in the project's directory tree?  (One less system specific

That can be done too.

Quote:> file to add/remove at install/uninstall.)  Similary, for AIX,
> (the only OS I have to support which does not seem to have
> a flavor of SysV'ish rc scripting) why not have the inittab
> entry point directly to a start script in the project's
> directories instead installing/removing /etc/rc.project.

It makes packaging easier. A product just drops it's own files
into the relevant directories and it automatically gets started
and stopped at the appropriate times. When you uninstall that
product, it simply has to delete its files. Multiple products
having to edit themselves into files shared by other things,
and edit themselves out when they are uninstalled, is always
more problematic.

Quote:> I think I know the answer department:

> Q: Is there a way for an application to get notification when
> shutdown is first invoked?  By default, humans typically get
> a minute of grace to finish up.  It would be nice if our
> scheduler knew that a shutdown was coming in nnn seconds.  It
> could supspend dispatching new jobs and condition running jobs
> to either finish up or get to a reasonable stopping point in
> the alloted grace interval.

Some varients of shutdown create /etc/nologin to prevent further
logins. You might be able to check for the existance of that
file.

On one system I administered, I rewrote shutdown to better suit
our needs, including things like sending SMB message to all samba
clients with resources mounted, and issuing the rwall warnings
all in parallel so loads of non-responding NFS clients didn't
make it take 10 times longer than you asked for.
You could produce a customised version for your environment.

--
Andrew Gabriel
Consultant Software Engineer

 
 
 

rc scriping: why init.d?

Post by Rich Gra » Sat, 05 Jul 2003 00:19:12





> > I'm cleaning up some rc scripts and have a few questions.

> > Q: Why put the start stop script in the init.d directory instead

> So the system admin can easily find it to run it by hand.

So this is mostly convention.  It also explains why handy things
above and beyond 'start' & 'stop' functionality (like 'restart')
are in the init.d scripts.  Good enough for me.

Quote:> > just linking the rc#.d/S & K scripts straight back to a file
> > in the project's directory tree?  (One less system specific

> That can be done too.

> > file to add/remove at install/uninstall.)  Similary, for AIX,
> > (the only OS I have to support which does not seem to have
> > a flavor of SysV'ish rc scripting) why not have the inittab
> > entry point directly to a start script in the project's
> > directories instead installing/removing /etc/rc.project.

> It makes packaging easier. A product just drops it's own files
> into the relevant directories and it automatically gets started
> and stopped at the appropriate times. When you uninstall that
> product, it simply has to delete its files. Multiple products
> having to edit themselves into files shared by other things,
> and edit themselves out when they are uninstalled, is always
> more problematic.

I certainly understand and appreciate the 'drop in to install'
and 'delete to uninstall' convention.  Unfortunately, the old
versions of AIX I have don't seem to support this.   One must
add/remove entries to inittab.  (Where they point comes back to
my above question: their place or ours?)

Quote:> > I think I know the answer department:

> > Q: Is there a way for an application to get notification when
> > shutdown is first invoked?  By default, humans typically get
> > a minute of grace to finish up.  It would be nice if our
> > scheduler knew that a shutdown was coming in nnn seconds.  It
> > could supspend dispatching new jobs and condition running jobs
> > to either finish up or get to a reasonable stopping point in
> > the alloted grace interval.

> Some varients of shutdown create /etc/nologin to prevent further
> logins. You might be able to check for the existance of that
> file.

Ah, we could have our processes optionally check for that file.
Thanks for the pointer.

Quote:> On one system I administered, I rewrote shutdown to better suit
> our needs, including things like sending SMB message to all samba
> clients with resources mounted, and issuing the rwall warnings
> all in parallel so loads of non-responding NFS clients didn't
> make it take 10 times longer than you asked for.
> You could produce a customised version for your environment.

Not practical for canned software, but certainly a reasonable thing
for a site to do.

Quote:

> --
> Andrew Gabriel
> Consultant Software Engineer

THANKS for your comments!

--
Rich


http://www.plustechnologies.com

 
 
 

rc scriping: why init.d?

Post by those who know me have no need of my nam » Sun, 06 Jul 2003 06:20:03


in comp.unix.programmer i read:



>> I'm cleaning up some rc scripts and have a few questions.

>> Q: Why put the start stop script in the init.d directory instead

>So the system admin can easily find it to run it by hand.

in addition.  /etc should always be available during boot, but the
directory in which `the project' lives may not.

--
a signature

 
 
 

1. /etc/rc.d/init.d/nfs not executed why?

Redhat 6.2 system, and the nfs script is in the above directory, is
linked into the other rc0.d, rc1.d as K20nfs.

But it doesn't seem to execute at startup.  The boot.log shows no
messages from it.   Just running it by hand causes nfs to start
properly.   I don't see why it's not running.

--

------------------------------------------------------------------------------
Neal Rhodes                       MNOP Ltd                     (770)-
972-5430
President                Lilburn (atlanta) GA 30247             Fax:
978-4741

                          http://www.mnopltd.com/

2. How do I change the resolution rate

3. init no longer runs rc.local - why??

4. Indianapolis Linux Support and Consulting service anyone?

5. init: cannot execute "/etc/rc.d/rc.S"

6. Problems with StarOffice 5.1a and DeadKeys under XFree 4.0

7. difference between /etc/rc.sysinit and /etc/rc.d/rc.sysinit ?

8. free linux more expensive than nt

9. which user does /etc/rc.d/rc.local / rc.sysinit run as?

10. SOLVED - Raid rc.0, rc.6 rc.S

11. Script to create startup scripts in /etc/init.d or /etc/rc?.d

12. SSHD (execvp) fails to start due to unable to read file -- /etc/rc.d/init.dfunctions

13. rc.local (init) problem