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 C653F3EC5E for ; Fri, 4 Jan 2002 20:09:57 -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 g0519vE06169 for ; Fri, 4 Jan 2002 20:09:57 -0500 Received: (from mail@localhost) by mail.redhat.com (8.11.6/8.8.7) id g0519vZ20092 for blinux-list@listman.redhat.com; Fri, 4 Jan 2002 20:09:57 -0500 Received: from mercury.mv.net (root@mercury.mv.net [199.125.85.40]) by mail.redhat.com (8.11.6/8.8.7) with ESMTP id g0519vd20088 for ; Fri, 4 Jan 2002 20:09:57 -0500 Received: from vanzandt.mv.com (vanzandt.mv.com [207.22.43.76]) by mercury.mv.net (8.8.8/mem-971025) with ESMTP id UAA14795 for ; Fri, 4 Jan 2002 20:09:53 -0500 (EST) Received: by vanzandt.mv.com via sendmail with stdio id (Debian Smail3.2.0.114) for blinux-list@redhat.com; Fri, 4 Jan 2002 19:59:14 -0500 (EST) Message-Id: Date: Fri, 4 Jan 2002 19:59:14 -0500 (EST) From: "James R. Van Zandt" To: blinux-list@redhat.com Cc: blinux-list@redhat.com In-reply-to: <3.0.6.32.20011227225916.0082e9d0@mail.doorpi.net> (message from Brent Harding on Thu, 27 Dec 2001 22:59:16 -0600) Subject: Re: regulating the time a process can run with crontab? References: <3.0.6.32.20011227225916.0082e9d0@mail.doorpi.net> Mime-Version: 1.0 (generated by tm-edit 7.106) 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 List-Help: List-Post: List-Subscribe: , List-Id: Linux for blind general discussion List-Unsubscribe: , List-Archive: Brent - 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 - Jim Van Zandt