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 10-07-2018, 10:37 AM   #1
fick_manning
LQ Newbie
 
Registered: Aug 2018
Posts: 15

Rep: Reputation: Disabled
view running deamon ps -p


hay guys
i am in a red hat course and in need to check if deamons that belongs to a service (chronyd)are running.
in the book they do it by ps -p PID
but when i do this i get this output:
Click image for larger version

Name:	linux123.jpg
Views:	23
Size:	243.4 KB
ID:	28749
as you can see i dont get nothing.
why is that and how i can verifay that the deamon is running?
 
Old 10-07-2018, 11:10 AM   #2
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 414

Rep: Reputation: 161Reputation: 161
The last line 'ps -p 675' shows chronyd, what's the problem?
 
Old 10-07-2018, 11:27 AM   #3
fick_manning
LQ Newbie
 
Registered: Aug 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
the assigment is that i need to verifay that that those deamons are running
but i dont understand the output - it is just headlines...
it dosent tell me if it is running or not
 
Old 10-07-2018, 11:45 AM   #4
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 414

Rep: Reputation: 161Reputation: 161
It does. Read 'man ps':
Code:
-p pidlist
   Select by PID.  This selects the processes whose process ID numbers appear in pidlist.  Identical to p and --pid.
When you pass a wrong PID process name is not shown and $? is set to non-zero. Try this:
Code:
$ ps -p 9999
  PID TTY          TIME CMD
$ echo $?
1
$ ps -p 1
  PID TTY          TIME CMD
    1 ?        00:00:21 init
$ echo $?
0
 
Old 10-07-2018, 12:06 PM   #5
fick_manning
LQ Newbie
 
Registered: Aug 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
first of all tnx for the help!!
so.. in my example under all of them theres is nothing excpet for the main PID and even then theres is a "?" under tty.
unlike youre example that there is time and in my example the time is 00:00 and in yours there is time that have past...
i am passing the pid's from the the command "systemctl status chronyd" whic are:
728
661
and the main PID: 675
 
Old 10-07-2018, 01:49 PM   #6
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 414

Rep: Reputation: 161Reputation: 161
In your screenshot you use incorrect PIDs 728 and 661 - there are no processes that have such PIDs on your system. In my example above I've used 9999 as a fake PID to represent the situation. Notice that my version of ps acts identically to yours and only prints header when non-existent PID is given and sets $? to non-zero.
 
Old 10-07-2018, 02:35 PM   #7
fick_manning
LQ Newbie
 
Registered: Aug 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by average_user View Post
In your screenshot you use incorrect PIDs 728 and 661 - there are no processes that have such PIDs on your system. In my example above I've used 9999 as a fake PID to represent the situation. Notice that my version of ps acts identically to yours and only prints header when non-existent PID is given and sets $? to non-zero.
tnx man!
 
Old 10-07-2018, 04:46 PM   #8
fick_manning
LQ Newbie
 
Registered: Aug 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
but than why are "728","661" cant be procces number? this is what i dont understand...
like in these blue box in i draw in the pic below (which you talked about erliar)
Click image for larger version

Name:	Capture.jpg
Views:	7
Size:	240.2 KB
ID:	28752
i mean - 728 661 - why cant it be a processes if that's what the command return (again in the blue box i draw)
i can use the 675 like on "ps -p 675" then why not "ps -p 661/728" ?
the systemctl command show those numbers as proccess

Last edited by fick_manning; 10-07-2018 at 04:50 PM.
 
Old 10-07-2018, 04:57 PM   #9
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,822

Rep: Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293Reputation: 1293
Quote:
Originally Posted by fick_manning View Post
but than why are "728","661" cant be procces number? this is what i dont understand...
like in these blue box in i draw in the pic below (which you talked about erliar)
Attachment 28752
i mean - 728 661 - why cant it be a processes if that's what the command return (again in the blue box i draw)
i can use the 675 like on "ps -p 675" then why not "ps -p 661/728" ?
the systemctl command show those numbers as proccess
Those processes have already ended. The only one continuing to run (the daemon) is 675
 
Old 10-09-2018, 08:57 PM   #10
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 1,203

Rep: Reputation: 549Reputation: 549Reputation: 549Reputation: 549Reputation: 549Reputation: 549
Perhaps 728 661 are threads (LWPs)?
Check the main PID for its threads
Code:
ps -fLp 675
Linux takes both processes and threads from the PID pool.

Last edited by MadeInGermany; 10-09-2018 at 08:59 PM.
 
Old 10-10-2018, 08:12 AM   #11
average_user
Member
 
Registered: Dec 2010
Location: Warsaw, Poland
Distribution: Slackware
Posts: 414

Rep: Reputation: 161Reputation: 161
I don't think so. Notice ExecStart - these processes probably died after doing exec(). It looks like 661 change to 675.
 
  


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
How I can Understand my GPS device is working running by gpsd deamon mhz_orcl Linux - Hardware 1 10-18-2012 12:45 PM
Running Apache as 'deamon' user/group. Drahcir Linux - Server 1 06-28-2007 06:28 AM
Music Player Deamon - running as multimedia iskrem Linux - Security 5 01-23-2005 02:35 PM
How could i disable deamon that's running which i don't need Paxmaster Linux - Software 1 10-11-2004 03:54 PM
Problems with running a deamon at boot time e0n Linux - Software 9 05-06-2003 07:48 PM

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

All times are GMT -5. The time now is 11:03 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration