Operating System - HP-UX
1830132 Members
2334 Online
109998 Solutions
New Discussion

rc script hangs at system reboot.

 
Vivek_10
New Member

rc script hangs at system reboot.

Hi All,
I need to start up a java program when the HP-UX system reboots. I have a rc script (say ABC)(in /sbin/init.d ) that calls another script (say XYZ)which starts up the java process. A symbolic link created in /sbin/rc3.d directory for this script (ABC).
All the environment variables required for my java program are set correctly in the XYZ script. My java process starts up, but the problem is no other start up scripts in rc3.d get executed, that have symblic links in sequence after the one I create. The HP-UX console shows me the status toggling between Start/Busy for this process. I am not sure why this is hanging. Could I have some help on this asap please. Thanks in advance - Vivek
8 REPLIES 8
Christian Gebhardt
Honored Contributor

Re: rc script hangs at system reboot.

Hi
Is there any output in /etc/rc.log for this startupscript ?

Chris
Paula J Frazer-Campbell
Honored Contributor

Re: rc script hangs at system reboot.

HI

Two options

1. Move this startup script to last in the startup sequence.

2. In the script pipe each line yo a log file.

i.e.

whatever > /tmp/Java.log
next >>/ tmp/Java.log
next >>/tmp/Java.log

Then examine the log file.

If the script start from the command prompt and not from the script then environment is to blame.

Are all the files systems available when the script is run?


HTH

Paula
If you can spell SysAdmin then you is one - anon
Clemens van Everdingen
Honored Contributor

Re: rc script hangs at system reboot.

Hi,

If you put set -x on top of the script, and you run it by hand, you might be able to see what causes the script to hang.

C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
John Palmer
Honored Contributor

Re: rc script hangs at system reboot.

Hi,

If your ABC script simply calls XYZ, it will wait for XYZ to finish. This won't happen because XYZ is your application, not just a script which starts it up.

Change your ABC script to run XYZ as an asynchronous process, either:

nohup XYZ &
or
XYZ &

In the latter case you should insert the statement
trap '' 1
in the XYZ script to prevent it terminating when its parent (ABC) exits.

Regards,
John
Vivek_10
New Member

Re: rc script hangs at system reboot.

Hi All,
Thanx for the immediate response.
rc.log has an output..in the sense when I do a "ps -eaf | grep java", my process is running.
As I told you the startup script after this in sequence doensnt get called at all.
Here is the dir listing:
"
troika:/sbin/rc3.d#>ls -lrt S*

lrwxrwxrwx 1 root sys 18 Oct 26 14:14 S950cdodb -> /sbin/init.d/cdodb

lrwxrwxrwx 1 root sys 23 Oct 26 14:14 S975cdocompdmn -> /sbin/init.d/cdocompdmn
"

S950cdodb gets executed, the java process runs but the next one S975cdocompdmn isnt called.

Iam still trying though...
Vivek.

Bill Hassell
Honored Contributor

Re: rc script hangs at system reboot.

Make sure that your startup script actually exits. You can do this by manually running it from a shell prompt. Your Java program should be placed in the background using & and protected from shell termination using nohup. The Java program will have been started correctly if the parent PID is 1 (init). If it is anything else, the script is waiting for the Java program to finish, hence no progress towards the next start script.


Bill Hassell, sysadmin
Vivek_10
New Member

Re: rc script hangs at system reboot.

Hi All..

Thanks for the help ...
The script works with nohup.
Vivek.
T G Manikandan
Honored Contributor

Re: rc script hangs at system reboot.

Lot of Vivek's here in the forum.

This side of the world does not properly respond to the points system.
I am also from this side of the world.


Vivek take a look at the points system and get some points to the admins who have helped you.

Thanks