Gentoo Archives: gentoo-user

From: Richard Fish <bigfish@××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] OT: bash scripting: implement uninterruptable sleep
Date: Tue, 28 Mar 2006 21:46:42
Message-Id: 7573e9640603281341q32e4ee33t6b3e1437e06534cc@mail.gmail.com
In Reply to: [gentoo-user] OT: bash scripting: implement uninterruptable sleep by Sascha Lucas
1 On 3/28/06, Sascha Lucas <sascha.lucas@×××××××××××××××××.de> wrote:
2 > Hi List,
3 >
4 > I have a shell script and want a uninterruptable sleep. /usr/bin/sleep
5 > itself seems to have its own signal handlers. How is it possible to sleep
6 > uninterruptable?
7
8 trap "echo 'Ctrl+C should not work'" INT
9 now=`date +%s`
10 expires=$(( $now + 10 ))
11 while test $now -lt $expires; do
12 sleep $(( $expires - $now ))
13 now=`date +%s`
14 done
15
16 -Richard
17
18 --
19 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] OT: bash scripting: implement uninterruptable sleep Sascha Lucas <sascha.lucas@×××××××××××××××××.de>