Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site calma.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!gatech!seismo!hao!noao!amd!pesnta!pyramid!decwrl!sun!calma!adams From: adams@calma.UUCP (Robert Adams) Newsgroups: net.news.sa Subject: Re: Are there problems if expire runs while news is being received? Message-ID: <65@calma.UUCP> Date: Mon, 18-Nov-85 12:27:14 EST Article-I.D.: calma.65 Posted: Mon Nov 18 12:27:14 1985 Date-Received: Thu, 21-Nov-85 07:05:31 EST References: <186@pluto.UUCP> Organization: GE/Calma Co., R&D Systems Engineering, Milpitas, CA Lines: 46 > I saw this happening, just wondered if this is a thing to avoid. Won't > both programs be updating the active file at the same time? Yes, there are problems if expire and the unbatcher run at the same time. Here I run a program called /usr/lib/new/newexpire which looks like: --------------- #! /bin/csh -f # expire that waits for the mail sender to be finished while ( -e /usr/spool/uucp/LCK..sun ) sleep 60 end sleep 10 # now wait for the unbatcher to finish while ( -e /usr/spool/uucp/LCK..ACTIVE ) sleep 60 end echo "$$" > /usr/spool/uucp/LCK..ACTIVE /usr/lib/news/expire -e 14 -a -A /user/adams/news/archive -n mod.ai net.ai /usr/lib/news/expire -e 14 -a -A /nfs/news_archive -n net.sources mod.sources /usr/lib/news/expire -e 14 rm -f /usr/spool/uucp/LCK..ACTIVE ------------- and then the program that is run by the news feeder ('sun' in this case) was replaced by the script: ------------- #! /bin/csh -f while ( -e /usr/spool/uucp/LCK..ACTIVE ) sleep 60 end echo "$$" > /usr/spool/uucp/LCK..ACTIVE echo "$$" > /usr/spool/uucp/LCK..BATCHER /usr/lib/news/unbatchnews $* rm -f /usr/spool/uucp/LCK..BATCHER rm -f /usr/spool/uucp/LCK..ACTIVE ------------- There are other things in the system that look for LCK..BATCHER (we feed other sites). Yes, this has critical region problems but, compared to what happens to /usr/lib/news/active when both expire and the unbatcher run at the same time, it is a little price. An aside, the advantage of using filenames as "LCK..*" is that they are already cleaned up by /etc/rc when the system boots. adams@calma.UUCP -- Robert Adams ...!ucbvax!calma!adams