Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-27-2005
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Data how to know how many user's connected to ftp and http server

i need to write a program to know how many users are presently connected to my ftp server and http server .
i need to keep a count of this and this count should be available to other different software . how to make this GLOBAL so that other softwares can access this count value
Sponsored Links
    #2  
Old 04-27-2005
RTM's Avatar
RTM RTM is offline Forum Advisor  
Registered User
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,090
Thanks: 0
Thanked 24 Times in 8 Posts
If it's on a UNIX system, try ps -ef |grep ftp or http (options may be different on your OS - try ps -ef). That will give you the number of connections for ftp or http normally

% ps -ef|grep -c ftp

% ps -ef|grep -c http

And please read the Rules. You posted the same question twice.
Sponsored Links
    #3  
Old 04-28-2005
Registered User
 
Join Date: Apr 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by RTM
If it's on a UNIX system, try ps -ef |grep ftp or http (options may be different on your OS - try ps -ef). That will give you the number of connections for ftp or http normally

% ps -ef|grep -c ftp

% ps -ef|grep -c http

And please read the Rules. You posted the same question twice.
if we are talking about Apache when the amount of httpd processes doesn't correlate directly to the amount of users connected. For example, the idle apache server has some httpd processes launched already.

Slava R.
    #4  
Old 04-28-2005
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
thanks for the reply , I tried the solution ,but even though there are no users connected to the ftp server it gives a value 2 and on the http server it gives a value 1.
and also i wrote the program using the given solution , i used the system("ps -ef|grep -c ftp > somefile") inside my program ,when i saw the output in the filet it had a value 3 , when no users were connected and if i used the same command on the prompt i get the value 2 how is this possible, please help me

And in the case of HTTP server there is no change like the above if no users are connected it gives the value 1
Sponsored Links
    #5  
Old 04-28-2005
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
thanks for the reply , I tried the solution ,but even though there are no users connected to the ftp server it gives a value 2 and on the http server it gives a value 1.
and also i wrote the program using the given solution , i used the system("ps -ef|grep -c ftp > somefile") inside my program ,when i saw the output in the filet it had a value 3 , when no users were connected and if i used the same command on the prompt i get the value 2 how is this possible, please help me

And in the case of HTTP server there is no change like the above if no users are connected it gives the value 1
Sponsored Links
    #6  
Old 04-28-2005
Just Ice's Avatar
Lights on, brain off.
 
Join Date: Mar 2005
Location: in front of my computer
Posts: 671
Thanks: 0
Thanked 7 Times in 7 Posts
try this one to give you actual connections at the time the sample was taken ...

Code:
netstat -a | awk '/EST/ && (/ftp/ || /http/)'

Sponsored Links
    #7  
Old 05-20-2005
Lestat's Avatar
Registered User
 
Join Date: Feb 2005
Location: Quito - Ecuador
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL Fast Solution

Just try:

nestat -A | grep ftp

and:

grep http

this way u will c only the established connections of each one or combine them with:

nestat -A | awk '/ftp/ || /http/'
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Command see all devices connected to Sun server nskumar Solaris 3 05-16-2012 07:02 AM
How do I run HTTP server on port 80 using a non root user? kevintse Linux 14 11-12-2010 11:05 AM
Shell script to display user logged last week and time connected ahernandez Shell Programming and Scripting 4 10-29-2010 02:32 PM
ALOM wont work when KVM connected to Sun Fire V440 server jimmy54321 Solaris 0 10-14-2010 11:04 AM
SAN Connected RedHat Server sallender Red Hat 4 03-13-2008 06:43 AM



All times are GMT -4. The time now is 04:55 PM.