nohup command in the script....

I want to know how to use a nohup command in the script........

I have to run following command

nohup /tmp/app/statuscheck.sh &

After typing this command I will type ctrl D to come to the prompt and the that command will run in backround.

Even after pressing & the command is not returing to prompt..

I want to include that command in a script . How to include it.what to do for Ctrl in the script..

The above command should not require you to press ctrl-d to continue issueing commands to the current shell.

If you want to start that script up in another script, just include the line exactly as you have it above, nohup will prevent it being stopped once your script exits and the & moves it to the background immediatly after starting up.

Your script cannot be writing to or reading from the TTY. This means you have to redirect all output and input away from the terminal. Some implementations of nohup do this for you, while others do not.

nohup script &>/dev/null </dev/null  &

You can then execute "wait"; the shell will pause until the script finishes.

Oooh! I'm going to file that one away for future reference, I'd always assumed nohup did that for you in all implementations, that one could have burned me bigtime :slight_smile: