LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2011, 09:18 PM   #1
Chupakabra
LQ Newbie
 
Registered: Jul 2011
Posts: 12

Rep: Reputation: Disabled
how to start a program in the back ground


I've tried searching it and everything I've seen posted on different sites didn't work.

i have my program set up in vi
it runs the way it is supposed too
but i need it to start in the back ground
I've tried bg
$bg
nohup

the program runs fine when running it in the fore ground but i need it to start up and run in the background.

any idea's on what i'm doing wrong,

this is what it looks like now

/labs/bash/count.sh &
mypid=$!
sleep 5
kill $mypid
 
Old 07-28-2011, 09:30 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
As I said in your other post, using '&' puts it in the background.... incidentally, you should have carried on in that thread/qn, not start a new one.

In any case, you REALLY need to read/reference these
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

and decide exactly what you want. Just try the cmds in there until you understand...
 
Old 07-28-2011, 09:50 PM   #3
Chupakabra
LQ Newbie
 
Registered: Jul 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
yea your right i should have,,, i thought i was done with the program but for some reason it won't run in the background. I have the & in the program. but i can see it counting. I had already marked the last q as solved so i thought i needed to start a new one.

thank you very much for the links, any information i can read up on is a great help
 
Old 07-28-2011, 11:34 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,250

Rep: Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684Reputation: 2684
When you say:
Quote:
but i can see it counting
You are aware that if your count.sh script does something like count from 1 to 10 and echo those numbers to the screen
that placing the running script in the background will not stop this from happening?
 
  


Reply


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
[SOLVED] place a shell script with tail -f in the back ground procfs Linux - Newbie 6 10-06-2010 11:29 PM
running back ground jobs in bash tcegrid Red Hat 2 01-09-2010 04:45 AM
LXer: Watch Your Back(ground) LXer Syndicated Linux News 0 07-17-2009 09:21 PM
Grub ..changing default back ground image?? stratotak Debian 3 12-06-2008 01:48 PM
what is command to display the process which is running in the back ground vinaykori Linux - General 2 02-07-2008 10:35 PM


All times are GMT -5. The time now is 12:43 AM.

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