SUMARY: /sbin/init.d script won't run at system startup, but will other times

From: Bruce B. Platt <bbp_at_comport.com>
Date: Wed, 15 Mar 2000 18:11:19 -0500

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_at_isc.upenn.edu> *
"Sieger" <r.sieger_at_sued-chemie.de>
Joerg Bruehe <joerg_at_sql.de>
Gernot Salzer <salzer_at_logic.at>
"Frank Wortner" <frank_at_bondnet.com>
<LHERCAUD_at_bouyguestelecom.fr> *
"Davis, Alan" <Davis_at_tessco.com> *
"Thomas M. Payerle" <payerle_at_physics.umd.edu>
"Hoai Tran" <tran.hoai_at_a2.abc.net.au>

and

Oisin McGuinness <oisin_at_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_at_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_at_comport.com, bruce_at_ bruce.platt_at_
OR, bruce_at_bbplatt.com
Received on Wed Mar 15 2000 - 23:13:39 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT