From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.44.254]) by listman.redhat.com (Postfix) with ESMTP id 175513EA3D for ; Sat, 5 Jan 2002 18:56:46 -0500 (EST) Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id g05NujE00903 for ; Sat, 5 Jan 2002 18:56:45 -0500 Received: (from mail@localhost) by mail.redhat.com (8.11.6/8.8.7) id g05NujN09138 for blinux-list@listman.redhat.com; Sat, 5 Jan 2002 18:56:45 -0500 Received: from idscc07.onewest.net (idscc07.onewest.net [199.104.81.26]) by mail.redhat.com (8.11.6/8.8.7) with ESMTP id g05Nujd09134 for ; Sat, 5 Jan 2002 18:56:45 -0500 Received: from rupin.localnet (du24.idfl-222.onewest.net [12.7.222.24]) by idscc07.onewest.net (8.11.3/8.11.3) with ESMTP id g05NpJi08056 for ; Sat, 5 Jan 2002 16:51:19 -0700 Received: from localhost (lcr@localhost) by rupin.localnet (8.11.6/8.11.6) with ESMTP id g05Nttv27818 for ; Sat, 5 Jan 2002 16:55:55 -0700 Date: Sat, 5 Jan 2002 16:55:54 -0700 (MST) From: "L. C. Robinson" To: Subject: Re: regulating the time a process can run with crontab? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: blinux-list@redhat.com Sender: blinux-list-admin@redhat.com Errors-To: blinux-list-admin@redhat.com X-BeenThere: blinux-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: blinux-list@redhat.com X-Reply-To: List-Help: List-Post: List-Subscribe: , List-Id: Linux for blind general discussion List-Unsubscribe: , List-Archive: And you might find that the "at" command is better choice for timing than "sleep" or cron. For example: mpg123 lecture.mp3 & SOUNDPROC=$! at now+2hours << End_of_here_document # Or: # at 9:30pm << End_of_here_document kill $SOUNDPROC End_of_here_document On Fri, 4 Jan 2002, James R. Van Zandt wrote: > One way to limit the duration of a command is to run it in a > subprocess (i.e. put the shell command in parentheses) and have the > parent kill it. Here's an example: > > #!/bin/bash > # try to send a string to the synthesizer via four different serial > #ports > for x in 0 1 2 3; do > (DTK_PORT=/dev/ttyS$x > echo "trying $DTK_PORT" > stty sane 9600 raw -echo crtscts <$DTK_PORT &&\ > stty -echo <$DTK_PORT &&\ > stty ixon ixoff <$DTK_PORT &&\ > echo "this is /dev/t t y s $x" $'\r' >$DTK_PORT )& > # if one of the above commands hangs, kill the process > sleep 2; kill $! >/dev/null 2>&1 > done -- L. C. Robinson reply to no_spam+munged_lcr@onewest.net.invalid People buy MicroShaft for compatibility, but get incompatibility and instability instead. This is award winning "innovation". Find out how MS holds your data hostage with "The *Lens*"; see "CyberSnare" at http://www.netaction.org/msoft/cybersnare.html