LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-09-2007, 09:55 AM   #1
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 707
Blog Entries: 1

Rep: Reputation: 32
Post job_id-How to find job_id of a running process


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
 
Old 12-09-2007, 10:01 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
jobs is a shell internal which lists running jobs controlled by that shell.
 
Old 12-09-2007, 10:05 AM   #3
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 707
Blog Entries: 1

Original Poster
Rep: Reputation: 32
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 :-|
 
Old 12-09-2007, 11:42 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
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.
 
Old 12-10-2007, 02:16 AM   #5
deepclutch
Member
 
Registered: Nov 2004
Distribution: Debian Testing+Sid
Posts: 707
Blog Entries: 1

Original Poster
Rep: Reputation: 32
yes.your explanation is what i needed ATM!thanks! and i am doubting with epiphany browser only!
 
  


Reply

Tags
background, control, job, screen, terminal


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
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 LinuxRam Linux - Newbie 4 09-09-2004 01:45 AM


All times are GMT -5. The time now is 01:22 AM.

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
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration