LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-12-2012, 12:36 AM   #1
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Rep: Reputation: Disabled
ps command - question mark query


I am seeing the question mark(?) in ps command output.I know that means no terminal has been attached to it but i dont know under which all scenarios this will happen.

does this happen

1)for running process in backgroud ??

2) for init process ??

3) for any process started with nohup. ???

4) for running init script using service manually ??

Can you please help me in understand the possible scenarios
 
Old 12-12-2012, 12:39 AM   #2
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
any detailed documentation /web link will be a great help
 
Old 12-12-2012, 01:45 AM   #3
redfox2807
Member
 
Registered: Jul 2012
Distribution: Debian testing/stable, Sailfish OS, Android
Posts: 119

Rep: Reputation: 16
May be this link would be of any help.
 
Old 12-12-2012, 02:39 AM   #4
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Thanks for the link
but how does the processes get disconnected themselves from their controlling terminals.ANy idea..
 
Old 12-12-2012, 02:50 AM   #5
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
It's the fork command.

Markus

Last edited by markush; 12-12-2012 at 02:52 AM.
 
Old 12-12-2012, 02:52 AM   #6
redfox2807
Member
 
Registered: Jul 2012
Distribution: Debian testing/stable, Sailfish OS, Android
Posts: 119

Rep: Reputation: 16
Deamons never have any controlling terminals. That's what they are intended for. As far as I know technically they're direct children of init process.

Following the Markus' comment, here's more details on how to daemonize a process

Last edited by redfox2807; 12-12-2012 at 02:59 AM.
 
Old 12-12-2012, 03:26 AM   #7
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Thanks redfox2807 , but i want to know that how we can predict by looking at the ps command output that whether the process is started by user terminal or not.

What i have experienced that certain processes which i start even those also showing question mark in there ps output not "tty terminal"

I want to know the scenarios under which the process will show Question Mark (?) in the ps command output even when it is triggered by a user(who logged onto the linux terminal)

Any clues on how to confirm this information
. pls suggest
 
Old 12-12-2012, 03:46 AM   #8
redfox2807
Member
 
Registered: Jul 2012
Distribution: Debian testing/stable, Sailfish OS, Android
Posts: 119

Rep: Reputation: 16
You can't have this sort of information without knowing what kind of program you start I think. The latest link has an example of a program that's run via a terminal but dissociates itself from the controlling terminal. It's a normal practice for many daemons like smbd to drop its privileges to a special user

I wonder why you are even concerned about controlling terminals. Having one or not just affects the way you interact with a program, you are in charge over it anyways

Last edited by redfox2807; 12-12-2012 at 03:47 AM.
 
Old 12-12-2012, 03:51 AM   #9
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
actually we have a requirement in which we want to be sure that a process is getting triggered by a user. This information i was thinking to get from PS command teminal column output.

But if a process dissociates from the terminal , then we cannot find this detail that what you mean ?? So no way out is it ???
 
Old 12-12-2012, 04:40 AM   #10
redfox2807
Member
 
Registered: Jul 2012
Distribution: Debian testing/stable, Sailfish OS, Android
Posts: 119

Rep: Reputation: 16
Could you be more specific? A program is always started by a user (i.e. with some user privileges) with the exception of init, that is triggered by Linux kernel directly. init defines and operates the whole user space. All the processes it triggers are run as root. Then in case of CLI login command is run. That's where a physical user comes into interaction with the system. As far as I can cogitate your intentions, your question goes to the area of user privileges, to define what a user is allowed to run and what's not. Maybe I'm just completely missing your point.
 
Old 12-12-2012, 10:41 AM   #11
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The concept of 'controlling terminal' is distinct from parental ancestry. All processes are children of some other process. The ps command shows the Parent Process ID (PPID). Is that the information you really want?
Any process can dissociate itself from a controlling terminal. Processes that do so are called daemons. Typically, these are launched as part of the system startup. Normally, a process is killed if it's controlling terminal closes (say, if the SSH connection is broken, or the modem hangs up, or an xterm gets closed). Daemon processes need to stay running perpetually, so cannot rely on a controlling terminal in order to stay alive.

--- rod.

Last edited by theNbomr; 12-12-2012 at 10:45 AM.
 
  


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
atq command output exclamation mark Effendi Linux - Newbie 2 06-28-2012 01:31 AM
Many question mark in command prompt angelo.c Red Hat 10 01-04-2012 11:51 PM
Question Mark aemerick Linux - Server 1 03-30-2009 04:16 PM
Question Mark issue, please help. onlineusers1 Linux - Newbie 2 01-14-2008 07:05 PM
Why does my penguin have a question mark? beejayzed General 5 03-23-2004 06:23 PM


All times are GMT -5. The time now is 10:21 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