LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 08: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, 08:30 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 08: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, 10:34 PM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:16 PM.

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
Open Source Consulting | Domain Registration