Operating System - HP-UX
1827713 Members
2666 Online
109967 Solutions
New Discussion

Re: Starting own program from init.d causes hang

 
SOLVED
Go to solution
Dag A.
Frequent Advisor

Starting own program from init.d causes hang

I am having trouble starting an application from the init configuration, this causes the startup to hang ("Busy/wait" stays on forever)

From script /sbin/init.d/PowerMonitor (attached):
-------------------------------------------
if [ "$POWERMONITOR" -eq 1 -a -x /usr/Powerware/LanSafe/Bin/PowerMonitor ]; then
/usr/Powerware/LanSafe/Bin/PowerMonitor
echo "PowerMonitor started"
set_return
--------------------------------------------

This is linked to from /sbin/rc2.d/ :
S995PowerMonitor -> /sbin/init.d/PowerMonitor

Testing the script starts the process OK, but the init prosess also remains active:

>/sbin/rc2.d/S995PowerMonitor start &
[1] 3199
>ps-ef |grep Power
root 2967 2966 3 21:02:30 pts/1 0:00 /usr/Powerware/LanSafe/Bin/PowerMonitor
root 2966 2923 0 21:02:30 pts/1 0:00 /sbin/sh /sbin/rc2.d/S995PowerMonitor start

The same happens when I restart the computer, causing "Start PowerMonitor" to remain in the busy/wait state indefinitely.
I had to telnet from another machine and kill the two processes.

I suspect that I have made some error in the script, I would expect the init process to terminate when it has done it's work.

Best regards,
3 REPLIES 3
Jeff_Traigle
Honored Contributor
Solution

Re: Starting own program from init.d causes hang

It would seem PowerMonitor does not exec itself. As you did on the command line with the rc script, background it...

if [ "$POWERMONITOR" -eq 1 -a -x /usr/Powerware/LanSafe/Bin/PowerMonitor ]; then
/usr/Powerware/LanSafe/Bin/PowerMonitor &
echo "PowerMonitor started"
set_return

You may need to nohup that also if it dies after the init process completes.
--
Jeff Traigle
Dag A.
Frequent Advisor

Re: Starting own program from init.d causes hang

That solves it

Thanks!
Dag A.
Frequent Advisor

Re: Starting own program from init.d causes hang

.