tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMARY: /sbin/init.d script won't run at system startup, but
@ 2000-03-15 23:11 Bruce B. Platt
  0 siblings, 0 replies; only message in thread
From: Bruce B. Platt @ 2000-03-15 23:11 UTC (permalink / raw)
  To: tru64-unix-managers

I had asked:

Why a script run during bootip wouldn't complete while it would if run
either from a command prompt, or during bootup in
the context of a user.  The original question follows below:


Thanks to:

John P Speno <speno@isc.upenn.edu>   *
"Sieger" <r.sieger@sued-chemie.de> 
Joerg Bruehe <joerg@sql.de> 
Gernot Salzer <salzer@logic.at> 
"Frank Wortner" <frank@bondnet.com> 
<LHERCAUD@bouyguestelecom.fr>  *
"Davis, Alan" <Davis@tessco.com>  *
"Thomas M. Payerle" <payerle@physics.umd.edu> 
"Hoai Tran" <tran.hoai@a2.abc.net.au> 

and

Oisin McGuinness <oisin@sbcm.com> 

John Speno was the first to point out that the problem was that init was
sending a HUP
signal to the script, and to solve the problem by having my script in
/sbin/init.d call the other
script by the command:

nohup /usr/local/jrun/jsm-default/startjsm.sh

This solved the problem.  Reading the man page for nohup(1) was informative.

I include the answer from Oisin McGuinness <oisin@sbcm.com>  in it's
entirety, since
he has answered this question before (I never found the summaries), and
it's a fine, complete explanation:

"I've replied to this question several times on the list; some people 
have even included my answer in the summary.
Quick version: On Digital Unix, init sends 2 HUP signals to anything (and 
therefore any children) of the scripts started from the rc*.d directories. 
If your program does not handle HUP, or you can't rewrite the program, trying 
using nohup, or explicitly trap (see Kernighan and Pike page 150-151 for 
doing this in shell scripts) and handle the HUP signal in the script.
The reason it runs fine from the command line is you don't send HUP's."


Thanks and regards,

Bruce




Original question:

 I have a startup script which is in
/sbin/init.d, pointed to by a link in /sbin/rc3.d,  (S57script).  This
script contains the lines:

#!/sbin/sh
/usr/local/jrun/jsm-default/startjsm.sh


The startjsm.sh script starts a java run time environment.  It needs to
start before the apache web server starts, and
when invoked as above, it doesn't during system bootup.  

However, if I (as root) execute the command
/usr/local/jrun/jsm-default/startjsm.sh, the process starts just fine.

Now, if I change the /sbin/init.d script to read:

#!/sbin/sh
su sr765 -c "/usr/local/jrun/jsm-default/startjsm.sh"
exit

then the script runs fine starts the java run time environment and all is well.

The scripts permissions are 755 and is owned by user 65533 and group 10.
As you can see, there is no user with that UID and no group with that GID.

The user sr765 is a member of the user and system groups, and is NOT the
owner of the /usr/local/jrun/jsm-default/startjsm.sh
script, nor is he the owner of the parent directories, and he is not a
member of the group of which these files are "membered" to.

sr765 happens only to be a user of the system who uses the java run time
environment in his work.

What do I not understand about the init process that would allow me to
start this wiithout the su -c  in script????

Any and all help solicited, and I will sumamrize.

Regards







+--------------------------------------+
Bruce B. Platt, Ph.D.
Comport Consulting Corporation
78 Orchard Street, Ramsey, NJ 07446
Phone: 201-236-0505  Fax: 201-236-1335
bbp@comport.com, bruce@ bruce.platt@
OR, bruce@bbplatt.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-03-15 23:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-03-15 23:11 SUMARY: /sbin/init.d script won't run at system startup, but Bruce B. Platt

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