|
|
|
|
|
|
| Author |
Message |
Satish *nix forums beginner
Joined: 23 Aug 2005
Posts: 3
|
Posted: Thu Jul 20, 2006 5:09 am Post subject:
Re: netstat - monitoring
|
|
|
works fine for me.. thank you.
-- Satish
Jon Fife wrote:
| Quote: | Satish wrote:
Hello All,
using the command 'netstat 5' gives me continous monitoring every 5
seconds. But when I use this in scripts. How do I stop it after 10
instances?
Meaning, 'sar -u 5 5' will monitor cpu for every 5 seconds for 5 times
and STOP.
How do I do the same with netstat?
There is no option for the number of outputs....
Is there something simmilar to 'netstat 5 5' ??
Any input is appreciated..
-- Satish
I'd suggest something like:
% cat netlist.sh
#!/bin/ksh
interval=$1
iterations=$2
netstat $1 &
sleep $(expr $1 \* $2)
kill $!
%./netlist.sh 5 3
(lan1)-> input output (Total)-> input output
packets packets packets packets
-2126205170 1367052622 -2122484504 1370773288
-2126205152 1367052625 -2122484486 1370773291
-2126205128 1367052626 -2122484462 1370773292
%
HTH,
Jon |
|
|
| Back to top |
|
 |
jon.fife@gmail.com *nix forums beginner
Joined: 07 Jun 2006
Posts: 8
|
Posted: Mon Jul 17, 2006 4:30 pm Post subject:
Re: netstat - monitoring
|
|
|
Satish wrote:
| Quote: | Hello All,
using the command 'netstat 5' gives me continous monitoring every 5
seconds. But when I use this in scripts. How do I stop it after 10
instances?
Meaning, 'sar -u 5 5' will monitor cpu for every 5 seconds for 5 times
and STOP.
How do I do the same with netstat?
There is no option for the number of outputs....
Is there something simmilar to 'netstat 5 5' ??
Any input is appreciated..
-- Satish
|
I'd suggest something like:
% cat netlist.sh
#!/bin/ksh
interval=$1
iterations=$2
netstat $1 &
sleep $(expr $1 \* $2)
kill $!
%./netlist.sh 5 3
(lan1)-> input output (Total)-> input output
packets packets packets packets
-2126205170 1367052622 -2122484504 1370773288
-2126205152 1367052625 -2122484486 1370773291
-2126205128 1367052626 -2122484462 1370773292
%
HTH,
Jon |
|
| Back to top |
|
 |
Satish *nix forums beginner
Joined: 23 Aug 2005
Posts: 3
|
Posted: Mon Jul 17, 2006 11:07 am Post subject:
netstat - monitoring
|
|
|
Hello All,
using the command 'netstat 5' gives me continous monitoring every 5
seconds. But when I use this in scripts. How do I stop it after 10
instances?
Meaning, 'sar -u 5 5' will monitor cpu for every 5 seconds for 5 times
and STOP.
How do I do the same with netstat?
There is no option for the number of outputs....
Is there something simmilar to 'netstat 5 5' ??
Any input is appreciated..
-- Satish |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Fri Nov 21, 2008 12:48 pm | All times are GMT
|
|
Society 2007 | Home Loan | Credit Card | Record Internet Radio with Tags | Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|