|
lug-bg: Re: question
- Subject: lug-bg: Re: question
- From: mecho@xxxxxxxxxx (Mr Mecho Puh)
- Date: Mon, 03 Sep 2001 02:46:13 +0100
#!/bin/sh
# replace ping 127.0.0.1 with your command
TIMEOUT=5
ping 127.0.0.1 & CMDPID=!$
#start watchdog
(sleep ${TIMEOUT}; kill -9 ${CMDPID}) &
WATCHDOGPID=$!
#wait for command
wait ${CMDPID}
kill ${WATCHDOGPID} >/dev/null 2>&1
# more advanced script
# http://www.oase-shareware.org/shell/scripts/quickies/timeout
--
Mecho Puh
===========================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|
|
|