]> git.pond.sub.org Git - empserver/blob - scripts/mapper/archive.pl
Import of Empire 4.2.12
[empserver] / scripts / mapper / archive.pl
1 #!/usr/local/bin/perl
2
3
4 #   Run by cron at 7:50 to archive (in web space) the current blitz mpeg
5 #   and to generate a new html index file.  Outputs html.
6 #       -Drake (dld@chem.psu.edu)
7
8 require 'ctime.pl';
9
10 chdir '/home/children/html/howitzer';
11
12 @file = ("Blitz-0", "Blitz-1","Blitz-2","Blitz-3","Blitz-4", "Blitz-5","Blitz-6", "Blitz-7");
13 unlink("$file[$#file].mpg","$file[$#file].gif","$file[$#file].txt","$file[$#file]Ann.txt");
14
15
16 for ($i=$#file;$i>0;$i--) {
17     rename($file[$i-1] . '.mpg',"$file[$i].mpg");
18     rename($file[$i-1] . '.gif',"$file[$i].gif");
19     rename($file[$i-1] . '.txt',"$file[$i].txt");
20     rename($file[$i-1] . 'Ann.txt',"$file[$i]Ann.txt");
21 }
22
23 if (-s 'Blitz.mpg') { system('cp -p Blitz.mpg Blitz-0.mpg'); }
24 if (-s 'Blitz.gif') { system('cp -p Blitz.gif Blitz-0.gif'); }
25 if (-s 'Blitz.txt') { system('cp -p Blitz.txt Blitz-0.txt'); }
26 if (-s 'Blitz.txt') { system('cp -p BlitzAnn.txt Blitz-0Ann.txt'); }
27
28 print "<html> <head>\n";
29 print "<title>Howitzer Blitz Archive</title>\n";
30 print "</head>\n<body>\n";
31 print "<h1>Archived Blitzes</h1>\n";
32 print "<ul>\n";
33
34 foreach $base (@file) {
35     $file = $base . '.mpg';
36     
37     if (-s $file) {
38         ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
39          $atime,$mtime,$ctime,$blksize,$blocks)
40             = stat($file);
41         chop($m=&ctime($mtime));
42         print "<li> $m <ul>\n";
43         print "<li> <a href=\"$file\"> <img alt=\"MPEG\" src=\"$base.gif\"><br>($size bytes)</a>\n";
44         print "<li> <a href=\"$base.gif\">Final Map</a>\n";
45         print "<li> <a href=\"$base.txt\">Reports</a>\n\n";
46         print "<li> <a href=\"$base" . "Ann.txt\">Announcements</a>\n</ul>\n";
47     }
48 }
49
50 print "</ul>\n";
51 print "</body> </html>\n";