|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
Quote:
Slava R. |
|
#4
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
||||
|
||||
|
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 | ||
|
![]() |
| Thread Tools | Search this Thread |
| 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 |
|
|