Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2002 12:10:15 -0500
From:      "Dan Langille" <dan@langille.org>
To:        Jason Andresen <jandrese@mitre.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: shell scripts that hang around forever
Message-ID:  <200201281710.g0SHAID11872@lists.unixathome.org>
In-Reply-To: <3C556AC3.AFB26074@mitre.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Thank you Jason.  Yes, it would be helpful.  And I had wondered if that 
was possible.  Cheers.

FWIW: I am now testing the script using the ports/sysutils/daemontools 
utilities.  That seems to be working well so far.  I will be writing a 
daemontools article for the Diary and will post the URL here for feedback 
before I make it public.

On 28 Jan 2002 at 10:14, Jason Andresen wrote:

> Wouldn't the following change be helpful if you always ^C the script to
> stop it?
> 
> > #!/bin/sh
> > 
> > LOCKFILE=${HOME}/msgs/processing.lock
> > MSGSDIR=${HOME}/msgs/FreeBSD/incoming
> 
> cleanup()
> {
>  rm -rf ${LOCKFILE}
>  exit
> }
> 
> trap cleanup sighup sigint sigquit sigill sigabrt sigterm
> 
> > lockfile -r 0 $LOCKFILE
> > RESULT=$?
> > #echo result='$RESULT'
> > if [ $RESULT = 0 ]
> > then
> >     cd ${MSGSDIR}
> >     while .
> >         do
> >         FILECOUNT=`ls | wc -l`
> > 
> >         if [ $FILECOUNT -ne 0 ]
> >         then
> >             ls | xargs -n 1 $HOME/scripts/test-freebsd-cvs.sh
> >         fi
> > 
> >         sleep 1
> >         done
> > 
>  cleanup
> > fi

-- 
Dan Langille
The FreeBSD Diary - http://freebsddiary.org/ - practical examples


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201281710.g0SHAID11872>