The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > SUN Solaris
Google UNIX.COM


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
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 09:25 AM
Bash: Can I run in background with pipes jjinno Shell Programming and Scripting 3 01-03-2008 04:51 PM
how to run script at background happyv Shell Programming and Scripting 4 09-22-2006 04:39 AM
submit a ksh script in background captainzeb Shell Programming and Scripting 4 11-08-2003 07:49 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-10-2007
Registered User
 

Join Date: Sep 2005
Posts: 3
Best practice to run bash script in background

nohup /bin/bassh $HOME/scripts/test.sh > $HOME/log/test.log 2>&1 &

nohup $HOME/scripts/test.sh > $HOME/log/test.log 2>&1 &


Which is the good practice to run a script in background of above two ?
does the first one will have any overhead on the system ?
our system is SunOS 5.10 Generic_118833-22 sun4v sparc SUNW,Sun-Fire-T200System.




test.sh is

#!/bin/bash
some functions
actual process
....
....
end of process....
exit 0



Thanks.

Ram
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-10-2007
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 637
There's no real difference. The first approach will work even if you have a different shell selected at the top of the script or have not set execute permissions on test.sh.

The second approach will use whatever shell is in the #! path and will only run if the execute bit is set.

Which approach to use depends on your environment and needs.
Reply With Quote
  #3 (permalink)  
Old 12-11-2007
Registered User
 

Join Date: Sep 2005
Posts: 3
Thanks Smiling Dragon
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:47 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0