From:	MERC::"uunet!VM1.NODAK.EDU!owner-anu-news" 16-MAR-1993 00:01:06.00
To:	Multiple recipients of list ANU-NEWS <ANU-NEWS@VM1.NoDak.EDU>
CC:	
Subj:	Re: Exclusive access to News data files?

Ed Wilts (ewilts@galaxy.gov.bc.ca) wrote:
> Is there a "proper" way for News to acquire exclusive access to the database?

Defining NEWS_STOP stops new incoming connections, and is supposed to also
close down existing ones I think - but I had no luck with that.

So I bashed together a script to kill every process on the system that was
accessing NEWS at the time :-) It searches for "<NNTP_" as a process name,
and also kills sessions running NEWS.EXE. I "REPLY/ALL" giving everyone
one minute to exit NEWS before running the script, but as it runs during
the wee hours of the morning, hopefully noone even notices it.

You will need to define newsexe to point to the FULL PATH to your NEWS.EXE
(as in disk:[dir]news.exe), and the search for <NNTP_ assumes MultiNet -
it may work for others - I assume the process name is defined by
NNTP_SERVER - not by the transport.

Anyway, I use C-News now, so this is yours to do with as you wish :-)

 --

Cheers

Jason Haar, Network Consultant

$! NEWS_KILL.COM
$ set noverify
$! Alterations:
$! JLH 17-07-90 Stopped the process from killing off the SYSMGR NEWS processes
$! JLH 03-09-90 Must even hit normal NEWS processes on the head.
$! JLH 03-09-90 Will explicitly mention NNTP processes as documented
$!              procedure doesn't appear to stop them.
$!
$! This file for booting all users running news off the current node
$! (called by newsskim via sysman when we want to clear the cluster in
$! order to get at the data base files).
$!
$   newsexe = f$trnlnm("NEWS_EXE")+"NEWS.EXE"
$    ip=0
$loop_over_users:
$    pid=f$pid(ip)
$    if pid.eqs."" then goto done_users
$    pname=f$getjpi(pid,"PRCNAM")
$    pstate=f$getjpi(pid,"STATE")
$    image = f$getjpi(pid,"IMAGNAME")
$    if (pname.eqs."") then goto done_users
$    if (f$extract(0,4,pname).eqs."NEWS") .and. (f$extract(0,7,pname).nes."NEWSM
GR" ) .or. -
(f$extract(0,f$locate(";",image),image).eqs.newsexe) .or. -
(f$extract(0,6,pname).eqs."<NNTP_")
$       then
$         write sys$output "Stopping process ''pid' (name) ''pname' !"
$         stop/id='pid
$       endif
$    goto loop_over_users
$done_users:
$ set verify
$ exit
