Operating System - HP-UX
1753554 Members
4817 Online
108795 Solutions
New Discussion юеВ

Re: How to properly use nohup?

 
SOLVED
Go to solution
John Payne_2
Honored Contributor

Re: How to properly use nohup?

Jorge,

We had problems identical to yours earlier this year and we opened an issue with HP about it. I was even able to duplicate the issue with sar. (This was on HPUX 11.0, by the way.) The issue got escalated back to the lab, and they said they would have to do a defect fix for nohup. We haven't seen it yet.

I found that if you invoked another shell, then ran the nohup script, then exited your child shell, the nohup would continue to run properly.

sh
nohup sar -v 5 5 &
exit

This would always make nohup work properly. We modified the script we were having trouble with, and haven't really thought about it for months. Is it possible for you to do something like that?

Hope it helps

John
Spoon!!!!
Jorge Fabregas
Regular Advisor

Re: How to properly use nohup?

Hello everyone,

Thanks for your help.

Steve! THANKS! That was it! Redirecting stderr!!!

It seems that nohup will only redirect stdout (to nohup.out) but it doesn't redirect stderr.

I ran the script as:

nohup /home/oracle/import.sh 1> out.log 2> out.err


and it worked! Thanks a lot!
Jorge Fabregas
Regular Advisor

Re: How to properly use nohup?

Hello everyone,

Thanks for your help.

Steve! THANKS! That was it! Redirecting stderr!!!

It seems that nohup will only redirect stdout (to nohup.out) but it doesn't redirect stderr.

I run the script as:

nohup /home/oracle/import.sh 1> out.log 2> out.err


and it worked! Thanks a lot!
Andrew Cowan
Honored Contributor

Re: How to properly use nohup?

One other problem caused by backgrounding jobs is when the process is attempting to talk directly to a psuedo tty device. A good demonstration of this is if you "nohup" the cu command. It will seem to keep running but the number of OS interrupts will go through the roof, as the process spirals out of control.

Great care should always be excerised when backgrounding any interactive program, as the results can be quite spectacular, and in extreme cases can even crash your entire system.