Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 May 1998 20:58:50 -0700 (PDT)
From:      Doug White <dwhite@gdi.uoregon.edu>
To:        kf7nn@kf7nn.com
Cc:        questions@FreeBSD.ORG
Subject:   Re: cqcam script
Message-ID:  <Pine.BSF.3.96.980510205512.2508P-100000@gdi.uoregon.edu>
In-Reply-To: <XFMail.980510224700.kf7nn@kf7nn.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 10 May 1998 kf7nn@kf7nn.com wrote:

> so what method do you suggest to lock the file?

Before you do your stuff, create a zero-length file (using `touch').  If
the file already exists, then exit without doing anything.  When you're
done doing your stuff, then remove the file.  This keeps only one script
running at a time.  

If you have procmail installed then use the `lockfile' command -- it does
a better job of lockfile management.

This little sh snippet is a very simple lockfile-managed script:

if [ ! -x file ] 
	touch file
	# do your stuff
	rm file
fi

Doug White                              | University of Oregon  
Internet:  dwhite@resnet.uoregon.edu    | Residence Networking Assistant
http://gladstone.uoregon.edu/~dwhite    | Computer Science Major



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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980510205512.2508P-100000>