If a process is to be started in the background, generally the following command works:
nohup somecommand.sh &
But I observed that on some linux machines the above command waits for an ‘enter’ key to be pressed and doesn’t return immediately. This is annoying especially when the command is being run as part of some java code that is trying to start some remote process in background. The java process would simply hang in such a case.
To fix the problem, use the following command instead:
nohup somecommand.sh >>nohup.out 2>&1 &
Advertisement