public inbox for blinux-list@redhat.com
 help / color / mirror / Atom feed
From: "James R. Van Zandt" <jrv@vanzandt.mv.com>
To: blinux-list@redhat.com
Cc: blinux-list@redhat.com
Subject: Re: regulating the time a process can run with crontab?
Date: Fri, 4 Jan 2002 19:59:14 -0500 (EST)	[thread overview]
Message-ID: <m16MfB4-00014FC@vanzandt.mv.com> (raw)
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)

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
  




  parent reply	other threads:[~ UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
 Brent Harding
 ` Mike Gorse
   ` Brent Harding
     ` Dave Mielke
     [not found]     ` <Pine.LNX.4.30.0112281125420.999-100000@dave.private.mielke .cc>
       ` Brent Harding
 ` A. R. Vener
 ` James R. Van Zandt [this message]
   ` L. C. Robinson
     ` Brent Harding
       ` James R. Van Zandt
         ` L. C. Robinson
           ` Brent Harding

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=m16MfB4-00014FC@vanzandt.mv.com \
    --to=jrv@vanzandt.mv.com \
    --cc=blinux-list@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).