LinuxQuestions.org
Help answer threads with 0 replies.
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 04-21-2010, 02:24 AM   #1
sumanch
LQ Newbie
 
Registered: Jan 2010
Posts: 24

Rep: Reputation: 16
How to find Apache Client session process Id


Hi ,
I am running Montavista distribution. I have an Apache server running in my machine. Now I want to know how many clients are connected to the Apache server and what are the process ids for those sessions. What is the command to do that? Please let me know.
 
Old 04-21-2010, 02:52 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Hi,

You mean something like:
Code:
netstat -tanpl|grep httpd
 
Old 04-21-2010, 04:01 AM   #3
sumanch
LQ Newbie
 
Registered: Jan 2010
Posts: 24

Original Poster
Rep: Reputation: 16
This is showing only the serve pids but I need client session pids.
 
Old 04-21-2010, 04:12 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
You cannot know the client's browser pid
You can only know the client's ip address and the pid of the apache child that serves the request.
 
Old 04-21-2010, 05:07 AM   #5
sumanch
LQ Newbie
 
Registered: Jan 2010
Posts: 24

Original Poster
Rep: Reputation: 16
Please let me know what is the command to see the child process pids which are serving the clients.
 
Old 04-21-2010, 05:37 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Here is the output for my apache
Quote:
netstat -tanpl|grep http
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1233/httpd
tcp 0 0 192.168.1.49:80 x.x.x.x:33153 ESTABLISHED9322/httpd
tcp 0 0 192.168.1.49:80 y.y.y.y:33154 ESTABLISHED9854/httpd
tcp 0 10800 192.168.1.49:80 z.z.z.z:59994 ESTABLISHED9910/httpd
From the above you see that 1233 is the PID of the apache daemon and 9322, 9854 and 9910 the childs PIDs (in bold for your convenience)
Compare it with the output of ps that shows all running apache processes:
ps -ef|grep httpd
Code:
root      1233     1  0 Apr10 ?        00:00:00 /usr/local/apache/bin/httpd -k start
nobody    9262  1233  0 11:25 ?        00:00:03 /usr/local/apache/bin/httpd -k start
nobody    9316  1233  0 11:47 ?        00:00:02 /usr/local/apache/bin/httpd -k start
nobody    9322  1233  0 11:49 ?        00:00:02 /usr/local/apache/bin/httpd -k start
nobody    9323  1233  0 11:49 ?        00:00:02 /usr/local/apache/bin/httpd -k start
nobody    9585  1233  0 12:36 ?        00:00:02 /usr/local/apache/bin/httpd -k start
nobody    9787  1233  0 13:05 ?        00:00:02 /usr/local/apache/bin/httpd -k start
nobody    9854  1233  0 13:11 ?        00:00:02 /usr/local/apache/bin/httpd -k start
nobody    9910  1233  0 13:20 ?        00:00:02 /usr/local/apache/bin/httpd -k start
nobody    9972  1233  0 13:23 ?        00:00:02 /usr/local/apache/bin/httpd -k start
nobody    9996  1233  0 13:26 ?        00:00:02 /usr/local/apache/bin/httpd -k start
Regards
 
  


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
Apache - Tomcat How to use session ID to confirm an active user session? klroller Linux - Server 4 10-08-2009 09:43 PM
Maintaing HTTP client session during Apache Server failover lqkums Linux - Server 0 04-27-2009 11:53 PM
Server and Client process using Openssl: Error: no client certificate available lokesh_c2004 Linux - Security 2 11-10-2008 08:30 AM
run a shell script on remote client from a server to find all its running process robin singh Linux - Newbie 7 10-03-2008 11:32 AM
Find the apache process eating my ram? stefaandk Linux - General 2 12-21-2006 12:20 AM

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

All times are GMT -5. The time now is 04:41 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
Open Source Consulting | Domain Registration