I have a question on the use of nohup in an ssh session. During more than three years my java software executed the following command daily using a remote ssh session:

cd some_path; chmod 777 script.sh; ./script.sh

the content of script is:

nohup java java_command parameters &

It's simple and working perfectly all the time in red hat machines.

In a new software installation using the same environment the command is not working. It is also not working if I execute it manually from any remote ssh session. However, if I change the content of script.sh, removing the nohup and &, then the command works properly.

What can be the problem? The ssh settings are the same. The only difference that I found is that umask is 0012 in the new installation and in the original installation it was 0022.

Additional info: The original installation is a RHEL 5.4 and the new installation is a RHEL 6.3. Is the 6.3 version more restrictive by default?

  • Do you get any error messages? – terdon Jun 10 '13 at 17:37
  • Is nohup available on the new system? Everyone allowed to execute it? – Hauke Laging Jun 10 '13 at 17:54
  • 2
    Probably not relevant to your problem, but you do not want mode 777. That allows write permission to everyone, which is exceptionally dangerous for something you're about to execute. You probably want 700. – derobert Jun 10 '13 at 20:49

Has your login shell changed?

Give this a try. Edit your script and change nohup to /usr/bin/nohup.

The reason it might be the solution is that login shells, such as the C shell, have their own version of "nohup". The C shell (or tcsh) nohup accepts a command but not a command argument. On the otherhand, /usr/bin/nohup can take a COMMAND and an optional command argument which is the way that you are using nohup.

  • Thanks ZaSter! I'll try it shortly and I will comment you the results. – Jose D. Jurado Jun 11 '13 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.