From: Alex Efros <powerman@powerman.sky.net.ua>
Subject: timeout chpst -L
Date: Mon, 13 Feb 2006 18:30:54 +0200 [thread overview]
Message-ID: <20060213163054.GC2511@home.power> (raw)
Hi!
Is there exists some standard utility to run other process with timeout?
ulimit isn't suitable because it can only limit used CPU time, while I'm
speaking about real time.
My goal is run `chpst -L` but don't allow it to hang forever.
Of course there simple custom solution:
chpst -L lock-file \
perl -e 'alarm(shift);exec(@ARGV)' $timeout \
$prog_to_execute
but I suppose there already exists such simple utility and also running perl
just to set alarm sounds little overkill.
Background:
I've a couple of scripts which run by fluxbox when I press Alt-Fx or
menu/winkey to switch between virtual desktops like it work in console.
These scripts:
- switch virtual desktop
- store ID of previous virtual desktop into file (this allow me
to switch between last two virtual desktops by pressing a menu key)
- show ID of current virtual desktop using OSD
The problem is what I sometimes switch too faster, these scripts execute
in parallel, switching to different virtual desktops, and file with ID
of previous desktop become corrupt (contain ID of current desktop instead).
To fix this I wanna run my script using `chpst -L`, but I don't wanna
fall into situation when I will not be able to switch virtual desktops
because my script will hang (never happens before, but everything happens
sometimes, especially bugs :)) and no new scripts will run because they
will wait for lock forever.
--
WBR, Alex.
next reply other threads:[~2006-02-13 16:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-13 16:30 Alex Efros [this message]
2006-02-13 20:18 ` Alex Efros
2006-02-14 8:45 ` Gerrit Pape
2006-02-14 10:23 ` Alex Efros
2006-02-14 10:36 ` Gerrit Pape
2006-02-14 11:01 ` Alex Efros
2006-02-14 11:21 ` Gerrit Pape
2006-02-14 11:30 ` Alex Efros
2006-02-14 11:36 ` Gerrit Pape
2006-02-14 11:54 ` Alex Efros
2006-02-14 12:39 ` Gerrit Pape
2006-02-14 12:53 ` Alex Efros
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=20060213163054.GC2511@home.power \
--to=powerman@powerman.sky.net.ua \
/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;
as well as URLs for NNTP newsgroup(s).