1820553 Members
3542 Online
109626 Solutions
New Discussion юеВ

nohup in shell script

 
SOLVED
Go to solution
Printaporn_1
Esteemed Contributor

nohup in shell script

Hi,
How can I put
nohup program_name &
in shell script without hanging the script.

thanks
enjoy any little thing in my life
4 REPLIES 4
Patrick Wallek
Honored Contributor

Re: nohup in shell script

I have a script set up to do that and the way I have done it is:

/usr/bin/nohup /command/you/want/to/run &


That should do it for you.
Printaporn_1
Esteemed Contributor

Re: nohup in shell script

Hi Patrick,

May be my word hanging the script is confuse,
Actually the script wait for a return key press after it output

Sending output to nohup.out

I just want script finish without waiting for any key press,

Thanks & please help
enjoy any little thing in my life
Steven Sim Kok Leong
Honored Contributor
Solution

Re: nohup in shell script

Hi,

If your program accepts pipes such as requiring a "Press any key to continue" scenerio, then, you can try:

# nohup echo | program &

If that doesn't work, then you will need expect which is an interactive scripting language. In this case, you will nohup your expect script which sends a set of responses based on the prompts it receives.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com

Paul Alberts
Advisor

Re: nohup in shell script

If you just tell it where to send the output then you won't get the message needing the CarriageReturn.
ex: nohup myprog >/var/tmp/myprog.log
ex: nohup myprog >/dev/null