From: Eric Lee on 13 Jul 2010 22:55 On Fri, 09 Jul 2010 23:00:52 +0000, Bit Twister wrote: > On Fri, 9 Jul 2010 22:54:49 +0000 (UTC), Rahul wrote: >> Is there a nice way to run a command with a timeout around it? >> >> For example sometimes I query ~100 servers about their status using a > > Personally, I use ping with a -w switch in my scripts. man page snippet. > > -w deadline > Specify a timeout, in seconds, before ping exits > regardless of how many packets have been sent or > received. In this case ping does not stop after count > packet are sent, it waits either for deadline expire > or until count probes are answered or for some error > notification from network. Just wondering, how did this happen? Eric -- Sacrifice is only a test.
From: Kenny McCormack on 14 Jul 2010 10:14 In article <i1j8vo$usb$1(a)speranza.aioe.org>, Eric Lee <openlinuxsource(a)gmail.com> wrote: >On Fri, 09 Jul 2010 23:00:52 +0000, Bit Twister wrote: > >> On Fri, 9 Jul 2010 22:54:49 +0000 (UTC), Rahul wrote: >>> Is there a nice way to run a command with a timeout around it? >>> >>> For example sometimes I query ~100 servers about their status using a >> >> Personally, I use ping with a -w switch in my scripts. man page snippet. >> >> -w deadline >> Specify a timeout, in seconds, before ping exits >> regardless of how many packets have been sent or >> received. In this case ping does not stop after count >> packet are sent, it waits either for deadline expire >> or until count probes are answered or for some error >> notification from network. > >Just wondering, how did this happen? How did *what* happen? -- > No, I haven't, that's why I'm asking questions. If you won't help me, > why don't you just go find your lost manhood elsewhere. CLC in a nutshell.
From: Ignoramus2398 on 14 Jul 2010 11:43 How about this DELAY=10 PotentiallyLongCommand & PID=$! (sleep $DELAY ; kill $PID) & wait $PID I just wrote a shell function: ExecuteWithTimeout() { local TIMEOUT=$1; shift $@ & local PID=$! (sleep 10; kill -9 $PID) & wait $PID } to use it type: ExecuteWithTimeout 10 ipmitool blah blah bla would kill ipmitool in 10 seconds.
First
|
Prev
|
Pages: 1 2 3 Prev: What is the best recent kernel Next: NFS writes became extremely slow overnight |