Gentoo Archives: gentoo-user

From: Sascha Lucas <sascha.lucas@×××××××××××××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] OT: bash scripting: implement uninterruptable sleep
Date: Fri, 31 Mar 2006 09:16:00
Message-Id: Pine.LNX.4.64.0603311103010.30880@tragbb.ehf.hav-fghggtneg.qr
In Reply to: Re: [gentoo-user] OT: bash scripting: implement uninterruptable sleep by Richard Fish
1 Hi,
2
3 On Tue, 28 Mar 2006, Richard Fish wrote:
4
5 > On 3/28/06, Sascha Lucas <sascha.lucas@×××××××××××××××××.de> wrote:
6 >> I have a shell script and want a uninterruptable sleep. /usr/bin/sleep
7 >> itself seems to have its own signal handlers. How is it possible to sleep
8 >> uninterruptable?
9 >
10 > trap "echo 'Ctrl+C should not work'" INT
11 > now=`date +%s`
12 > expires=$(( $now + 10 ))
13 > while test $now -lt $expires; do
14 > sleep $(( $expires - $now ))
15 > now=`date +%s`
16 > done
17
18 excellent! take system time and loop sleep until time is over.
19
20 Thanks,
21
22 Sascha.
23 --
24 gentoo-user@g.o mailing list