1753474 Members
4626 Online
108794 Solutions
New Discussion юеВ

nohup is not working

 
SOLVED
Go to solution
Alex Lavrov.
Honored Contributor

nohup is not working

Hello,

Sorry for cross-posting, but since this problem also occurs in HPUX and nobody answers in Linux forum, thought to post here also.

I'm trying to execute a java program in the background, but when I use "nohup" and "&" I get a message that the process was "Stopped". Actually nothing can go to the background. No matter what program I try.

Is there some setting that system administrator can change in order to allow processes go background?

Thank you.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
7 REPLIES 7
Jose Mosquera
Honored Contributor

Re: nohup is not working

Hi,

What is the content of the hohup file?

rgds.
Alex Lavrov.
Honored Contributor

Re: nohup is not working

Hi,

It's empty. The process instantly is stopped.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Matti_Kurkela
Honored Contributor
Solution

Re: nohup is not working

Which shell are you using? Bash, HP-UX POSIX /usr/bin/sh, or something different?

The shell might be running with job control disabled. In any POSIX-compliant shell, "echo $-" should produce a string of letters (and possibly numbers). If that string includes lowercase letter 'm', job control is enabled. Interactive shells normally run with job control enabled by default, but I guess some login script might disable it with "set +m". Unless you're running a restricted shell, this setting should be changeable by the user.

Run "stty -a |grep tostop". If the "tostop" TTY option is set, any background job stops as soon as it tries to produce any output to the terminal. If the result includes "-tostop", the tostop output is not set.

When you use nohup, is it really executing /usr/bin/nohup or something else (maybe a shell internal command or an alias)?

"which nohup" or "whence nohup" might be useful to confirm you're using the real nohup command.

Does the java program try to do something special with the TTY input/output? For example, if it's trying to request a password, it might use /dev/tty explicitly to bypass any input/output redirection, much like the "passwd" command does.

MK
MK
Alex Lavrov.
Honored Contributor

Re: nohup is not working

Hi Matti,

Actually it happens with any command/script/program I'm trying to use. This specific Java program is a product, that runs fine on hundreds of other systems. I think it's just the configuration in this specific network.

Thank you for the suggestions, I'll try them.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Hakki Aydin Ucar
Honored Contributor

Re: nohup is not working

I recommend another approach if you would work for you, is that to use screen instead of nohup.

Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).
If your local computer crashes, or you are connected via a modem and lose the connection, the processes or login sessions you establish through screen don't go away.
You can resume your screen sessions with the following command: screen -r

More info:
http://tutorials.assistprogramming.com/unix-screen-utility-how-do-i-use-that.html
Dennis Handly
Acclaimed Contributor

Re: nohup is not working

>when I use "nohup" and "&" I get a message that the process was "Stopped".

Have you tried redirecting stdin so there is nothing to read?
nohup foo < /dev/null &
Alex Lavrov.
Honored Contributor

Re: nohup is not working

Thank you, the solution was:

stty -tostop
I don't give a damn for a man that can only spell a word one way. (M. Twain)