From: Sascha Lucas <sascha.lucas@rus.uni-stuttgart.de>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] OT: bash scripting: implement uninterruptable sleep
Date: Fri, 31 Mar 2006 11:06:16 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.0603311103010.30880@tragbb.ehf.hav-fghggtneg.qr> (raw)
In-Reply-To: <7573e9640603281341q32e4ee33t6b3e1437e06534cc@mail.gmail.com>
Hi,
On Tue, 28 Mar 2006, Richard Fish wrote:
> On 3/28/06, Sascha Lucas <sascha.lucas@rus.uni-stuttgart.de> 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
prev parent reply other threads:[~2006-03-31 9:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-28 8:13 [gentoo-user] OT: bash scripting: implement uninterruptable sleep Sascha Lucas
2006-03-28 21:41 ` Richard Fish
2006-03-31 9:06 ` Sascha Lucas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0603311103010.30880@tragbb.ehf.hav-fghggtneg.qr \
--to=sascha.lucas@rus.uni-stuttgart.de \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox