Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 07-05-2004, 09:15 AM   #1
Registered: Jun 2004
Location: Morgantown, WV
Distribution: Slackware 10.0
Posts: 39

Rep: Reputation: 15
Run a program in the background???

I am working with a cluster of computers running RedHat 7.3 (yeah I am going to upgrade the least the kernels on all the nodes).
This cluster is used to run simulations of molecular structires.

The Jobs on the cluster are run by way of a bash shell script. Currently the bash scripts are run from a terminal and that terminal is left open for the duration of the job (sometimes takes as long as 4 days!), AND id the terminal window is closed the job stops running....I guess What I am wondering is:

Is there a way to run a bash script in the background in a way that it dosent require a terminal to stay open? I know there has to be since multiple programs run as daemons in the background to do all kinds of jobs... I an just courious hotw to Give non-root users the ability to run these jobs. I just do not even know where to start searching for an answer.... any info would be very appricated!
Old 07-05-2004, 09:27 AM   #2
Registered: Aug 2003
Location: Portland, Oregon
Distribution: RedHat, Libranet
Posts: 438

Rep: Reputation: 30
You want to use the disown command.

You will find details in the bash man page. Specifically, look at the job control section.
Old 07-05-2004, 09:32 AM   #3
Registered: Jun 2004
Location: Morgantown, WV
Distribution: Slackware 10.0
Posts: 39

Original Poster
Rep: Reputation: 15
Awsome, thanks for the quick reply! that seems to work perfectly I will integrate it into the bash scripts.... you rock!
Old 07-06-2004, 04:22 AM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You can also use the 'nohup' command. This command will allow you to log off, and produce a log file which by default is nohup.out. The command means 'no HUP'.
Old 07-06-2004, 06:44 AM   #5
Registered: Dec 2002
Location: California
Distribution: Slackware & LFS
Posts: 799

Rep: Reputation: 33
Or simply background the job by following the command with an ampersand, like so:

./ &

And now, during our limited-time, two-for-one special offer: The best place to start searching for an answer to your linux questions is here.

--- Cerbere
Old 07-06-2004, 07:40 AM   #6
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Originally posted by Cerbere
The best place to start searching for an answer to your linux questions is ....
*cough* here *cough*



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to run a process in the X background sh4d0w13 Linux - General 6 09-12-2005 03:54 PM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 01:27 AM
Run programs in background... Cybers19 Linux - Newbie 1 06-02-2004 04:54 AM
run command in background using C syberdave Programming 3 04-03-2004 07:43 AM
Program In background frankprogramer Linux - Software 1 10-30-2002 03:56 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration