tags:

views:

23

answers:

2

Is there an alternative for the timeout command on the Mac OSx. The basic requirement is I am able to run a command for a specified amount of time.

e.g:

timeout 10 ping google.com

This program runs ping for 10s on Linux.

+1  A: 

Unfortunately there is no timeout program on macos afaik, however you can try the answers metioned here: http://stackoverflow.com/questions/601543/command-line-command-to-auto-kill-a-command-after-a-certain-amount-of-time

Futhermore if you really want to run "ping" here you can just run

ping -t 10 google.com
redCube
Ping was really a sample. I want to run a program to collect some metrics
sheki
A: 

The Timeout Package from Ubuntu / Debian can be made to compile on Mac and it works. The package is available at http://packages.ubuntu.com/lucid/timeout

sheki