![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems . |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| differnce between these cmds | wrapster | Shell Programming and Scripting | 1 | 03-25-2008 11:49 AM |
| Using sudo for specific cmds | scottsl | UNIX for Advanced & Expert Users | 3 | 12-07-2006 03:31 AM |
| difference between ksh and bsh | tads98 | Shell Programming and Scripting | 4 | 08-10-2005 05:05 AM |
| difference | rajashekaran | UNIX for Advanced & Expert Users | 1 | 04-23-2002 01:59 AM |
| ?script/cmds 2 list open files???? | bn80865 | UNIX for Dummies Questions & Answers | 3 | 01-22-2001 02:55 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
What's the difference: 'nuhup cmds' Vs 'cmds &'
Hello,
Case: If I want to run a script background and logout, which command should I use ? 1)# ./script_name & 2)# nohup script_name 3)# nohup script_name & And any differences ? What happens if I redirect the output to a file? I learned somewhere that the (1) format will stop after you logout, because the kernel sends SIGHUP to all of your processes after the Shell exits. But my experence told me that the script keep running after I logout. So, I am confused here: Could someone giudes me out... Thanks, |
|
|||||
|
......
3)# nohup script_name &
thats the right one.... nohup = the process is the child of the id 1 script_name = starts the script & = starts the script in backround, otherwise you could not exit your terminal.... greetings pressy |
|
||||
|
Thanks for reply.
Yes, I knew the "script_name &" can put it background and I can logout, then check it next time login. Suppose the script doesn't trap any signal, or exit on signal, just an infinite loop and sleep, my confusion is if "script_name & " can have the job done, why prefer to use 'nohup'? What's benificial of using 'nohup'? "man nohup" says it immune to SIGHUP. From user's point of view, if I don't trap or exit on SIGHUP, is there any reason that I must or better use "nohup" to start the script? |
|
|||||
|
The default action for HUP is to exit. If you don't defeat that somehow, your script will exit when it gets a HUP. nohup is one way. And scripts can ignore HUP if they want to. If a script is explicitly ignoring HUP, nohup is not also needed. But some people will use nohup rather than checking the script.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|