source: trunk/gsdl/bin/script/nightly.pl@ 1970

Last change on this file since 1970 was 1970, checked in by sjboddie, 23 years ago

Added more usage information to all perl programs and removed a few
programs that are no longer useful.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# nightly.pl
6#
7# A component of the Greenstone digital library software
8# from the New Zealand Digital Library Project at the
9# University of Waikato, New Zealand.
10#
11# Copyright (C) 1999 New Zealand Digital Library Project
12#
13# This program is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of the License, or
16# (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26#
27###########################################################################
28
29
30# This program will find all the collections under $GSDLHOME/collect
31# and use the update.pl script to update them all. It should be run
32# every night to keep mirror collections up-to-date.
33
34
35BEGIN {
36 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
37 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
38 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
39 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
40 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
41}
42
43use strict;
44use arcinfo;
45use colcfg;
46use plugin;
47use docprint;
48use util;
49use parsargv;
50
51sub print_usage {
52 print STDERR "\n";
53 print STDERR "nightly.pl: Attempts to update all Greenstone collections found on\n";
54 print STDERR " the local filesystem by calling update.pl for each of\n";
55 print STDERR " them.\n\n";
56 print STDERR " usage: $0 [options]\n\n";
57 print STDERR " options:\n";
58 print STDERR " -verbosity number 0=none, 3=lots\n";
59 print STDERR " -importdir directory Where to place the mirrored material\n";
60 print STDERR " -archivedir directory Where the converted material ends up\n";
61}
62
63
64&main ();
65
66sub main {
67 my ($verbosity, $collectdir, $name, $collection);
68
69 if (!parsargv::parse(\@ARGV,
70 'verbosity/\d+/2', \$verbosity )) {
71 &print_usage();
72 die "\n";
73 }
74
75
76 # get the contents of the collect directory
77 $collectdir = &util::filename_cat($ENV{'GSDLHOME'}, "collect");
78 opendir(CDIR, $collectdir) || die "Cannot open $collectdir: $!";
79 my @files = readdir(CDIR);
80 closedir CDIR;
81
82
83 # update each collection
84 foreach $name (@files) {
85
86 $collection = &util::filename_cat($collectdir, $name);
87
88 # igore entries for "." and ".."
89 next unless ($name =~ /[^\.]/);
90
91 # ignore modelcol
92 next if ($name eq "modelcol");
93
94 # ignore entries that are not directories
95 next unless (-d $collection);
96
97 # ignore directories that do not have a subdir called etc
98 next unless (-d &util::filename_cat($collection, "etc"));
99
100 print "Updating: $name\n";
101 print `update.pl $name`;
102
103 }
104
105}
Note: See TracBrowser for help on using the repository browser.