View Single Post
Old 08-31-2004, 08:44 AM  
flexor
Registered User
 
Join Date: Jan 2004
Posts: 8

First of all, I would recomand rewriting it in Perl.

If you want to keep it in bash, try to use signals, something like this http://www.signaltonoise.net/library...ariables2.html

Or search Google for "bash timeout script"

[in a nutshell]

TimerOn()
{ ( o p e n accolade thingy here, obfuscate by GFY board code)
sleep $TIMELIMIT && kill -s 14 $$ &
# Waits XXX seconds, then sends sigalarm to script.
}

[...]
trap Int14Vector 14
#Int14Vector is a function called when sig 14 is traped by script


See sleep, kill and trap for details.



HIH
flexor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote