#! /opt/bin/perl
# ________________________________________________________________
# /\ /\ CyberWeb SoftWare: Internet Information Systems
# -{-<*>-}- World-Wide Web
# __\/_\/_________________________________________________________
# Author : Lucy Richmond,
# Purpose : Create the files needed to update the production servers.
# Usage : called from the mirror.sh script
# Comment : The update log file in read, the file to create the tar
# file, the file to re-ht the moved files, and the ht version
# of the list of updated files are created.
# Disclaimer: This software is provided freely on the understanding
# that the Author will not be held responsible for any
# problems arising from it's use, and that there is no
# support except by agreement on a fee for services.
# ________________________________________________________________
require "ctime.pl"; # script to get date and time is in this file
require "Software/Perl/ht_subs.pl"; # script for getting HTML file title
# The input file is the old.log in the Log directory
open(LG, ") {
($dt, $file) = split ;
$_ = $file;
$file{$_}++;
}
# check each file, discard the non-mirrored files and create the output file entries
foreach (sort keys %file) {
next if /test/;
next if /DS9\/Walkthrough/;
next if /Spectrum/;
next if /Richmond/;
next if /Development/;
next if /\_dev/;
next if /Update\.html/;
# strip off the leading slash
s/^\///;
# if first file to mirror, create tar and list.ht files
if (!$uf) {
$uf = 1;
open(LIST,">Update.ht")||die$!; # list of updated files
open(TAR,">mir_tar.sh")||die$!; # create the tar file
open(DO, ">do_ht.sh")||die$!; # file of ht commands
# initialize the files
print TAR "tar -cvf mirror.tar \\\n";
print TAR " Update.ht ";
print TAR "\\\n do_ht.sh" ;
print DO "ht n Update \n";
# initialize all the list ht file
# get the date and time then start the ht file
$Date = &ctime(time);
print LIST <
$Date
EOT
}
# if the updated files is an html file, see if a .ht version exists
if (/\.html$/) {
if (!$fh) {
$fh = 1;
open (CK, ">check.lst")||die$!; #files to check links
}
$full = $_;
$ht = $_;
chop ($ht);
chop ($ht);
if (-f "$ht") {
# if first ht file, create output file
# write the ht version to the tar file
$_ = $ht;
# remove the .ht from the file name
chop ($ht); chop ($ht); chop ($ht);
print DO "ht n $ht\n";
print CK "$full\n";
}
}
print TAR "\\\n $_ " ;
# call Gettitle for the files names
$file = "/opt/u/richmond/DEV/$full";
$pr = $full;
if (open (IN, "<$file")) {
$pr = &GetTitle (1);
}
print LIST "- $pr \n";
}
# if files were opened, finish and close them
if ($uf) {
print TAR "\n";
close(TAR);
print LIST "
\n";
close(LIST);
close(DO);
close(CK);
}