From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org)
	by nuthatch.gentoo.org with esmtp (Exim 4.54)
	id 1FOM1R-0002We-Mc
	for garchives@archives.gentoo.org; Tue, 28 Mar 2006 21:46:42 +0000
Received: from robin.gentoo.org (localhost [127.0.0.1])
	by robin.gentoo.org (8.13.6/8.13.5) with SMTP id k2SLjjTJ022045;
	Tue, 28 Mar 2006 21:45:45 GMT
Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.234])
	by robin.gentoo.org (8.13.6/8.13.5) with ESMTP id k2SLfdhW004226
	for <gentoo-user@lists.gentoo.org>; Tue, 28 Mar 2006 21:41:39 GMT
Received: by wproxy.gmail.com with SMTP id i6so307722wra
        for <gentoo-user@lists.gentoo.org>; Tue, 28 Mar 2006 13:41:38 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
        b=XRtKqGTWuKuiw8FAnFwXU464HYPRjHPsUDPnKyMoxvUNHwq7yaMK44whu4bUBPiVA8BSJapxEIM2uBcs/LvWhEEspbrKuxxeRGiTiBLm0YSWJiRONZ+NUyNR53OEaKk3tDl4m8hpeLFFQHY3zb/3etoqN/cMlwR0/qDMyVMc1eE=
Received: by 10.54.152.17 with SMTP id z17mr15145wrd;
        Tue, 28 Mar 2006 13:41:38 -0800 (PST)
Received: by 10.54.126.6 with HTTP; Tue, 28 Mar 2006 13:41:38 -0800 (PST)
Message-ID: <7573e9640603281341q32e4ee33t6b3e1437e06534cc@mail.gmail.com>
Date: Tue, 28 Mar 2006 14:41:38 -0700
From: "Richard Fish" <bigfish@asmallpond.org>
Sender: richard.j.fish@gmail.com
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] OT: bash scripting: implement uninterruptable sleep
In-Reply-To: <Pine.LNX.4.64.0603281004080.30414@tragbb.ehf.hav-fghggtneg.qr>
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: inline
References: <Pine.LNX.4.64.0603281004080.30414@tragbb.ehf.hav-fghggtneg.qr>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by robin.gentoo.org id k2SLfdhW004226
X-Archives-Salt: c59cd787-5e2e-4b5c-b663-152db9498f8b
X-Archives-Hash: 31af5d84231eb5dace636e1d99b44259

On 3/28/06, Sascha Lucas <sascha.lucas@rus.uni-stuttgart.de> wrote:
> Hi List,
>
> I have a shell script and want a uninterruptable sleep. /usr/bin/sleep
> itself seems to have its own signal handlers. How is it possible to sleep
> uninterruptable?

trap "echo 'Ctrl+C should not work'" INT
now=`date +%s`
expires=$(( $now + 10 ))
while test $now -lt $expires; do
    sleep $(( $expires - $now ))
    now=`date +%s`
done

-Richard

-- 
gentoo-user@gentoo.org mailing list