Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > get command to run for x seconds then quit

get command to run for x seconds then quit
Thread Tools
hadocon
Mac Elite
Join Date: Oct 2001
Location: Internet
Status: Offline
Reply With Quote
Apr 4, 2004, 03:45 PM
 
I am doing an experiment and I want to determine the data rate of a proprietary networked device.

What I want to do is connect to it with Netcat and see how much data I get in a minute. Is there any way I can tell Netcat (or any other cmd line app) to run for only a specified amount of time?

I am looking for a simple command like this:

time -60 | nc 1.2.3.4 1234

thanx
20+ year MacNN forum member. MacBook Air 11" 1.6Ghz 4GB 128GB Backlit Keyboard, 4S, iPad Mini
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Apr 5, 2004, 09:22 AM
 
Originally posted by hadocon:
I am doing an experiment and I want to determine the data rate of a proprietary networked device.

What I want to do is connect to it with Netcat and see how much data I get in a minute. Is there any way I can tell Netcat (or any other cmd line app) to run for only a specified amount of time?

I am looking for a simple command like this:

time -60 | nc 1.2.3.4 1234

thanx
Something like this should work:

Code:
/usr/bin/nc 1.2.3.4 1234 > nc.log 2>&1 & pid=`ps -auxww | grep "/usr/bin/nc"` sleep 60 kill -9 $pid
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
   
 
Forum Links
Forum 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 On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:00 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,