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 1FPFjb-0002Jf-W1 for garchives@archives.gentoo.org; Fri, 31 Mar 2006 09:16:00 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.6/8.13.5) with SMTP id k2V9FIfs013698; Fri, 31 Mar 2006 09:15:18 GMT Received: from charybdis.rus.uni-stuttgart.de (charybdis.rus.uni-stuttgart.de [129.69.1.58]) by robin.gentoo.org (8.13.6/8.13.5) with ESMTP id k2V96T03015683 for ; Fri, 31 Mar 2006 09:06:30 GMT Received: from localhost (localhost [127.0.0.1]) by charybdis.rus.uni-stuttgart.de (Postfix) with ESMTP id 1B6F5345088 for ; Fri, 31 Mar 2006 11:06:29 +0200 (CEST) Received: from charybdis.rus.uni-stuttgart.de ([127.0.0.1]) by localhost (charybdis [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14583-01-90 for ; Fri, 31 Mar 2006 11:06:25 +0200 (CEST) Received: from uni-stuttgart.de (mbox.uni-stuttgart.de [129.69.1.9]) by charybdis.rus.uni-stuttgart.de (Postfix) with ESMTP id EAF0E345085 for ; Fri, 31 Mar 2006 11:06:25 +0200 (CEST) X-Virus-Scanned: by mbox.uni-stuttgart.de Received: from [129.69.11.67] (account ruslucas@po2.uni-stuttgart.de HELO gentoo.rus.uni-stuttgart.de) by uni-stuttgart.de (CommuniGate Pro SMTP 4.2.8) with ESMTP-TLS id 38377862 for gentoo-user@lists.gentoo.org; Fri, 31 Mar 2006 11:06:17 +0200 Date: Fri, 31 Mar 2006 11:06:16 +0200 (CEST) From: Sascha Lucas To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] OT: bash scripting: implement uninterruptable sleep In-Reply-To: <7573e9640603281341q32e4ee33t6b3e1437e06534cc@mail.gmail.com> Message-ID: References: <7573e9640603281341q32e4ee33t6b3e1437e06534cc@mail.gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at charybdis.rus.uni-stuttgart.de X-Spam-Status: No, hits=-4.399 tagged_above=-999 required=5 tests=ALL_TRUSTED, BAYES_00 X-Spam-Level: X-Archives-Salt: a3311f81-a402-4e52-af67-c95ff47acb34 X-Archives-Hash: 48ad7b8396a9474b4d944682ff3346cd Hi, On Tue, 28 Mar 2006, Richard Fish wrote: > On 3/28/06, Sascha Lucas wrote: >> 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 excellent! take system time and loop sleep until time is over. Thanks, Sascha. -- gentoo-user@gentoo.org mailing list