From:	MERC::"uunet!VM1.NODAK.EDU!owner-anu-news" 28-MAR-1993 07:01:21.50
To:	Multiple recipients of list ANU-NEWS <ANU-NEWS@VM1.NoDak.EDU>
CC:	
Subj:	Re: NEWS housekeeping procedures and CONVERT/RECLAIM

In article <1993Mar26.135219.120122@marshall.wvnet.edu>, boag@marshall.wvnet.edu
 (Bob Boag) writes:
> I seem to recall reading something about a logical called NEWS_STOP or
> NEWS_SHUTDOWN, but now I can't seem to remember where it was or what exactly
> how if functioned.
>
> What I would like to be able to do is to make sure there are "absolutely" no
> processes accessing the NEWS.ITEMS, NEWS.GROUPS, or the HISTORY.V60 files so
> that when I try to compress them with CONVERT/RECLAIM, it will not fail becaus
e
> another user has the file opened.

This is my convert_db.com.  It uses the NEWSSHUTDOWN program found in the
latest 6.1 beta release.

$!Last Modified: 20-MAR-1993 08:12:39 by EWILTS : CONVERT_DB.COM
$! This procedures handles the weekly database convert run
$!
$ SS$_CANCEL = "%X00000030"
$ if p1 .nes. "" then goto 'p1'
$ MCR SYSMAN
SET ENVIRONMENT/CLUSTER
DO define/system/exec news_stop yes
$ wait 0:20:0
$!
$top:
$ on warning then goto pause
$ define/user news_locked_command "@news_manager:convert_db convert_db"
$ run news_manager:newsshutdown
$ exit
$pause:
$ if $status .eqs. SS$_CANCEL
$ then
$       write sys$output "News currently LOCKED - waiting 10 minutes"
$       wait 0:10:0
$       goto top
$ endif
$!
$convert_db:
$ show dev news_root
$ on warning then goto groups_failed
$ write sys$output "Compressing news.groups at ''f$time()'"
$ edit/fdl/analyze=news_root:newsgroups.fdl/nointer news_root:newsgroups.fdl
$ convert/statistics/fdl=news_root:newsgroups -
        news_root:news.groups news_root:news.groups_new
$ rename news_root:news.groups_new news_root:news.groups
$ purge/log news_root:news.groups
$ purge news_root:newsgroups.fdl
$ goto do_items
$groups_failed:
$ if f$search("news_root:news.groups_new").nes."" then -
        delete/log news_root:news.groups_new;*
$ purge/log news_root:news.groups
$ purge news_root:newsgroups.fdl
$ gosub inform_error
$do_items:
$ on warning then goto items_failed
$ write sys$output "Compressing news.items at ''f$time()'"
$ analyze/rms/fdl/output=news_root:newsitems.fdl news_root:news.items
$ edit/fdl/analyze=news_root:newsitems.fdl/nointer news_root:newsitems.fdl
$ convert/statistics/fdl=news_root:newsitems.fdl -
        news_root:news.items news_root:news.items_new
$ rename news_root:news.items_new news_root:news.items;
$ purge/log news_root:news.items
$ purge news_root:newsitems.fdl
$ goto do_history
$items_failed:
$ if f$search("news_root:news.items_new").nes."" then -
        delete/log news_root:news.items_new;*
$ purge/log news_root:news.items
$ purge news_root:newsitems.fdl
$ gosub inform_error
$do_history:
$ on warning then goto history_failed
$ write sys$output "Compressing history.v60 at ''f$time()'"
$ if f$search("news_root:history.v60").eqs."" then goto history_failed
$ analyze/rms/fdl/output=news_root:history.fdl news_root:history.v60
$ edit/fdl/analyze=news_root:history.fdl/nointer news_root:history.fdl
$ convert/statistics/fdl=news_root:history.fdl -
        news_root:history.v60 news_root:history.v60_new
$ rename news_root:history.v60_new news_root:history.v60;
$ purge/log news_root:history.v60
$ purge news_root:history.fdl
$ goto rebuild_done
$history_failed:
$ if f$search("news_root:history.v60_new").nes."" then -
        delete/log news_root:history.v60_new;*
$ purge/log news_root:history.v60
$ purge news_root:history.v60
$ gosub inform_error
$rebuild_done:
$ set noon
$ write sys$output "''f$time()' Indexed file rebuild complete"
$ MCR SYSMAN
SET ENVIRONMENT/CLUSTER
DO deassign/system/exec news_stop
$ exit
$!
$INFORM_ERROR:
$ show dev news_root
$ mail SYS$INPUT usenet -
  /subject="Automatic NEWS-ADD-SKIM alarm: CONVERT_DB FAILED (''f$time()')"
The News_Skim job failed to convert the database - please investigate.
$ RETURN

--
Ed Wilts, BC Systems, 4000 Seymour Place, Victoria, B.C., Canada, V8X 4S8
EWilts@Galaxy.Gov.BC.CA     Office:  (604) 389-3430   Fax: (604) 389-3412
