LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Newbie
User Name
Password
Linux - Newbie This 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

Tags used in this thread
Popular LQ Tags , , , , , , , ,

Reply
 
Thread Tools
Old 12-09-2007, 09:55 AM   #1
deepclutch
Member
 
Registered: Nov 2004
Location: kerala,India
Distribution: Ubuntu Intrepid,Fedora 10
Posts: 645
Thanked: 0
Post job_id-How to find job_id of a running process


[Log in to get rid of this advertisement]
Hello,
How to find job_id of a process bg'ed.i mean how to get the job_id for running "fg" command?
I tried pid,but fg command insists on job_id.please help me which command will display job_id.
thanks
deepclutch is offline  
Tag This Post
Reply With Quote
Old 12-09-2007, 10:01 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu (x86), Debian (PPC)
Posts: 3,495
Thanked: 6
jobs is a shell internal which lists running jobs controlled by that shell.
matthewg42 is offline     Reply With Quote
Old 12-09-2007, 10:05 AM   #3
deepclutch
Member
 
Registered: Nov 2004
Location: kerala,India
Distribution: Ubuntu Intrepid,Fedora 10
Posts: 645
Thanked: 0

Original Poster
now how do i use fg and bg without job_id :? for eg; i invoked firefox from terminal without "&".now if i want to detach the process from shell,how can we achieve it :? i am aware of pid,but job id is something new for me thanks,waiting for reply :-|
deepclutch is offline     Reply With Quote
Old 12-09-2007, 11:42 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu (x86), Debian (PPC)
Posts: 3,495
Thanked: 6
A job is a concept which is only meaningful inside the shell. Please read the JOB CONTROL section of the bash manual page for an overview (search for upper case JON CONTROL).

When a shell is closed, any backgrounded jobs attached to that terminal are send a signal SIGHUP (hang up). Most programs will terminate when they receive this signal. A program may choose to do something else other than terminate on receiving SIGHUP. At least in Ubuntu, firefox seems to be one of these, so you can just bg the process and then close the terminal.

For programs which terminate when you close the terminal which they are attached to, you have a few options:
  1. When you start the program by prefixing it with "nohup", for example:
    Code:
    nohup myprogrm &
  2. Run the program in GNU Screen. Screen lets you detach the shell from the terminal, and then re-attach it at a later date. This is particularly useful for programs like terminal-based IRC clients... For you can detach the screen session from the terminal which is funning locally, log out, go to work and ssh to your machine and then re-attach to the shell running the IRC client.
  3. You can use the disown shell internal to remove the job from the shell's process group. This means it will not be sent a SIGHUP when the terminal is closed.
matthewg42 is offline  
Tag This Post , , , , , ,
Reply With Quote
Old 12-10-2007, 02:16 AM   #5
deepclutch
Member
 
Registered: Nov 2004
Location: kerala,India
Distribution: Ubuntu Intrepid,Fedora 10
Posts: 645
Thanked: 0

Original Poster
yes.your explanation is what i needed ATM!thanks! and i am doubting with epiphany browser only!
deepclutch is offline  
Tag This Post
Reply With Quote

Reply

Bookmarks


Thread Tools

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
Need to find which processor is running a process demosp Linux - General 3 11-06-2007 08:34 PM
how know if process running shifter Programming 7 06-18-2007 04:37 AM
how to find out what serivces/process are running in fedora yinglcs Linux - General 2 03-06-2006 11:40 AM
Running process sonu1082 Linux - Software 2 11-25-2004 06:32 AM
Process not running akshatyadav Linux - Newbie 4 09-09-2004 01:45 AM


All times are GMT -5. The time now is 11:44 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration