Operating System - HP-UX
1833853 Members
2506 Online
110063 Solutions
New Discussion

Start/Stop script terminates even with nohup

 
SOLVED
Go to solution
Susan Prosser
Advisor

Start/Stop script terminates even with nohup

Guys

Hopefully someone can help me with this as I am starting to pull my hair out....

I have a script under /sbin/init.d called stream. Bascially it sets up environ variable and then issues a command to run a command as a specific user....

STREAM_CONFIG=/stream/config

nohup su ssr -c $STREAM_CONFIG/stream.rc >> $log 2>&1

The stream.rc file looks like....
cd /stream/stream/bin
./stream -p 4501 -s ssr &

It rellies on Oracle running. Oracle gets started up before S855stream If I start up via /sbin/init.d/stream start the process starts and stays up and the log file reports that it is happy.

I have linked it ... /sbin/init.d/stream in the /sbin/rc3.d as S855stream

I can do.. /sbin/rc3.d/S855stream start and again the process starts and stays up.

If I reboot the system - the process starts and dies as soon as the login prompt appears on the console. The log file reports 'User Abort'

I did try it though cron ( thinking that perhaps some PATHS/ENV werent being picked up ) that worked!

Any ideas of how I can keep this process running or another way of starting it up please?
3 REPLIES 3
Steven E. Protter
Exalted Contributor
Solution

Re: Start/Stop script terminates even with nohup

Shalom,

If this process depends on oracle, starting it with nohup inadvisable. This is because the startup will not wait and is run in background. This will let other process start first.

Steps to fix.

1) Get it to start correctly on the command line.
2) Create a script that does what you did on the command line.
3) Test the script.
4) Add a line to the script env > /tmp/normal.txt
5) Add env > /tmp/startup.txt to the normal startup.
6) Compare the two files. Make the environment in the startup script the same as the one from the working script.
7) Reboot, the service will start.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Lolupee
Regular Advisor

Re: Start/Stop script terminates even with nohup

I will advice that you use full path names for all your file references. instead of $ then try to add some debugging lines to it. Running scripts from during startup or cron mostly require this.
James R. Ferguson
Acclaimed Contributor

Re: Start/Stop script terminates even with nohup

Hi Kevin:

You are no-hupping the 'su'. That's not what you want! To see what's happening (in part), at command line, do:

# nohup su someuser -c somescript

Regards!

...JRF...