Operating System - HP-UX
1838571 Members
3411 Online
110128 Solutions
New Discussion

Re: startup script works fine from command promt, but nor during boot

 
Gisela Hoffmann_2
Occasional Advisor

startup script works fine from command promt, but nor during boot

Hi,
I have a script and the links, I need, to start Radius Server during boot.
The script works, but the Server doesn't start:
-> /etc/rc.log:
Starting NavisRadius
Output from "/sbin/rc3.d/S400NavisRadius start":
----------------------------
Starting the RMI Registry Server...
The RMI Registry Server failed to start.
Starting the State Server...
The State Server failed to start.
Starting the Radius Server.....

It does with the same command at the prompt:
$/sbin/rc3.d/S400NavisRadius start
Starting the RMI Registry Server...
The RMI Registry Server has been started.
Starting the State Server...
The State Server has been started.
Starting ....

Anybody any idea? The Script ist attached.

Thanks
Gisela
17 REPLIES 17
Steven Gillard_2
Honored Contributor

Re: startup script works fine from command promt, but nor during boot

Try specifying 'nohup' in your startup script:

'start')
nohup /opt/NavisRadius/bin/nr start
;;
'stop')
nohup /opt/NavisRadius/bin/nr stop
;;

Regards,
Steve
S.K. Chan
Honored Contributor

Re: startup script works fine from command promt, but nor during boot

You probably need a "nohup" in front of the command '/opt/Navis Radius..' which will run and ignore hangups and quits.
Why not use the 'template' script in /sbin/init.d and stick in your commands there ?
Gisela Hoffmann_2
Occasional Advisor

Re: startup script works fine from command promt, but nor during boot

I tried it with "nohup" as well, but id made no difference.
melvyn burnard
Honored Contributor

Re: startup script works fine from command promt, but nor during boot

are there any variables that this needs to run that would be set when you use the command line, but not there at start time?
you could do:
set -x
as the first line after setting the shell

then see what you get in the rc.log
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Gisela Hoffmann_2
Occasional Advisor

Re: startup script works fine from command promt, but nor during boot

I have no idea about variables that could be set after boot and not at start of the script which starts almost at last. All Variables for Radius are set in /opt/NavisRadius/bin/nr.

Iput set -x in the script and now I see the the executed commands in the /etc/rc.log, there is no problem.
The part of the log ist attached.
Frank Slootweg
Honored Contributor

Re: startup script works fine from command promt, but nor during boot

You say that you have tried it with nohup, but your second log does not show nohup!

When you run the "/sbin/rc3.d/S400NavisRadius start" manually, does the script *finish*, i.e. do you get a prompt?

In any case, change the "/opt/NavisRadius/bin/nr start" (and "... stop") lines to:

/usr/bin/nohup /opt/NavisRadius/bin/nr start &1 >>/tmp/NavisRadius.log &
sleep 10

Please carefully note *all* the 'funny' characters in the above command. They are there for a purpose.
Ceesjan van Hattum
Esteemed Contributor

Re: startup script works fine from command promt, but nor during boot

Hi,

Your startupscript in each runlevel has a certain sequence number. Yours is 400 (S400xxxxx).

It seems that some other programs are loaded between the S400 startup and the actual loginprompt. Try to move your script to the end of the sequence: like S400xxxx to S999xxxx.

If this solves your problem, it was just a matter of the startup-sequence.

Succes, Rgds, Ceesjan
D. Jackson_1
Honored Contributor

Re: startup script works fine from command promt, but nor during boot

Is there a config file in the /etc/rc.config.d/ directory??

If so check it out and make sure it is set to start at boot.

Start=1


HTH
pap
Respected Contributor

Re: startup script works fine from command promt, but nor during boot

Hi I think you have following problem in your script.

Look at the lines below from your script.I just copy and pasted these line and added line number for easy explanation.

1 'start')
2 /opt/NavisRadius/bin/nr start
3 ;;
4 'stop')
5 /opt/NavisRadius/bin/nr stop
6 ;;


MAke changes as below and your script should work then.

1. In line 2 remove the start argument at last.
so your new line 2 will become as below

/opt/NavisRadius/bin/nr

2. In line 5 remove the stop argument
your new line 5 will become as below

/opt/NavisRadius/bin/nr

I think you are all set now.

check the script using following command.

#/sbin/sh -xv /sbin/init.d/SCRIPTNAME start
#/sbin/sh -xv /sbin/init.d/SCRIPTNAME stop

This will give you any errors and exit status of your script. If it is 0 you are done.

Thanks,
-Piyush

"Winners don't do different things , they do things differently"
pap
Respected Contributor

Re: startup script works fine from command promt, but nor during boot

Change the sequence number to S992****

for that you have to delete the link and re establish it.

-Piyush
"Winners don't do different things , they do things differently"
Rick Beck
Occasional Advisor

Re: startup script works fine from command promt, but nor during boot

Double check path references in and about the actual executable being started. The environment used by RC is pretty different from a root shell.
Darrell Allen
Honored Contributor

Re: startup script works fine from command promt, but nor during boot

Hi Gisela,

I have a similar problem with a script that won't run at boot. The vendor said it can't be done (but what do they know?).

My application is the server side of a client / server product. I believe my problem is rpc related but I don't know.

Not finding a solution, I came up with a work-around. Instead of trying to start my application at boot, I would schedule an "at" job to run the start script 5 minutes after booting. Works like a charm.

The attached is a scrubbed copy of my /sbin/rc3.d script. I have it as S999... so that it is the last rc script to run when booting (into normal run level 3).

It may not help you but try it if you like. If so, you need to verify root is in /var/adm/cron/at.allow.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
pap
Respected Contributor

Re: startup script works fine from command promt, but nor during boot

We will appreciate if you can apply points to participants......:))..


Thanks.

-Piyush.
"Winners don't do different things , they do things differently"
Sanjay_6
Honored Contributor

Re: startup script works fine from command promt, but nor during boot

Hi,

Try to start it with the same userid that can run the script from the command prompt,

'start')
/opt/NavisRadius/bin/nr start
;;

Change this to,

'start')
su - user_name -c "/opt/NavisRadius/bin/nr start"
;;

Or you can also check if this script needs a prerequisite, like for example, it may need that some other appliction / database should be up before this script can run properly.

We have an application which starts in the startup script and needs the oracle database to be available. If it does not find the oracle database available, it shut's itself down withour starting properly. The same starts properly if it finds the oracle database is up.

Hope this helps.

Regds

Gisela Hoffmann_2
Occasional Advisor

Re: startup script works fine from command promt, but nor during boot

Thanks everybody!!
I tried everything, but it still doesn't work. I found a problem with the path and solved that - now I get no errors anymore, but it just does't start.
The suggestion of Darrell Allens with the "at" job seems to be a very good idea. How do I schedule
that shortly after boot?

Thanks
Gisela
Darrell Allen
Honored Contributor

Re: startup script works fine from command promt, but nor during boot

Hi Gisela,

Here's a brief explanation of my previously attached script.

In the "start" case statement, I check to see if the script is being executed during boot by using ps to see if /sbin/rc is running. If /sbin/rc is running, I use the "echo ... | at + 5 minutes" command to schedule the "at" job for 5 minutes in the future. I then exit.

If /sbin/rc is not running, I continue the script and run the start.xxx script.

Since this is the last rc script I have defined in rc3.d, I know that the system should be completely booted in the next few seconds. I chose 5 minutes as my delay simply because this app didn't have to be available immediately upon booting.

So basically the only part I added to allow this to schedule an "at" job instead of running immediately was:
# If called at boot time schedule an at job because the XXX
# daemons start then die at boot time
res=`/usr/bin/ps -ef | grep "/sbin/rc" | grep -v grep`
if [ X"$res" != X ]
then
echo "/xxx/start.xxx >>/var/local/logs/xxx.out 2>&1" | at now + 5 minutes
exit
fi

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Gisela Hoffmann_2
Occasional Advisor

Re: startup script works fine from command promt, but nor during boot

Thanks Darrell!
I changed my script with the "at" command and it works perfectly!

Gisela