From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1017 Path: news.gmane.org!not-for-mail From: Alex Efros Newsgroups: gmane.comp.sysutils.supervision.general Subject: timeout chpst -L Date: Mon, 13 Feb 2006 18:30:54 +0200 Organization: asdfGroup Inc., http://powerman.asdfGroup.com/ Message-ID: <20060213163054.GC2511@home.power> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1139848260 29345 80.91.229.2 (13 Feb 2006 16:31:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 13 Feb 2006 16:31:00 +0000 (UTC) Original-X-From: supervision-return-1253-gcsg-supervision=m.gmane.org@list.skarnet.org Mon Feb 13 17:30:57 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1F8gbI-0004AH-6p for gcsg-supervision@gmane.org; Mon, 13 Feb 2006 17:30:56 +0100 Original-Received: (qmail 3792 invoked by uid 76); 13 Feb 2006 16:31:17 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 3786 invoked from network); 13 Feb 2006 16:31:17 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline User-Agent: Mutt/1.5.11 Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1017 Archived-At: 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.