1c1
< #!/usr/local/bin/perl
---
> #!/usr/bin/perl
29c29,37
< # HA1.1 jv 07/12/1998 Ported HC1.4 to HA1.1
---
> # HC1.5 saw 05/07/1999 Add a Y2K hack in the reverse sorting of directory names. Put years 9x to
> # the end of the sort. Will work till 2090.
> # HC1.6 saw 14.05.1999 During transfer from temp to finaly directory,
> #
fields are added.
> # HC1.64 saw 09.07.1999 Update Acclerator logbook URL's
> # HC1.65 saw 06.10.1999 Require filenames to start with YYMM.
> # HC1.70 saw 04.01.2000 Truncate year returned by localtime to 2 digits
> # so that last 7 day thing works.
> # HC1.71 saw 05.01.2000 Make run start stuff optional
32c40
< $SCRIPT_VERSION="HA1.1";
---
> $SCRIPT_VERSION="HC1.71";
40d47
<
49,50c56,68
< $webmgr = "/net/fs7/home/adaq/public_html/halog";
< $httptj = "A HREF=http://www.cebaf.gov/~adaq/halog";
---
> $logbook_account = "cdaq"; # The account under which the logbook runs
> $server = "www.cebaf.gov"; # The server on which the log book is accessed
> #
> # This is the stuff most likely to change for new log books
> #
> $logbook_dirname = "hclog"; # Logbook name (for constructing directories)
> $logbook = "HCLOG";
> $LOGTITLE = "Hall C";
> $do_runstart_stuff = "1"; # Do the Run Start stuff
> $extraheader_html = qq{};
> #
> # End of custom stuff
> #
52,55c70,71
< #$auto_regexp = "^Run \\d+:"; # Regular expression to find automatic entries
< $auto_regexp = "End_of_Run"; # Regular expression to find end of run entries
< $auto_regexp2 = "Accounting"; # Regular expression to find accounting entries
< $auto_regexp3 = "Start_Run"; # Regular expression to find accounting entries
---
> $webmgr = "/home/$logbook_account/$logbook_dirname";
> $httptj = "A HREF=http://$server/~$logbook_account/$logbook_dirname";
56a73,74
> $auto_regexp = "^Run \\d+:"; # Regular expression to find automatic entries
>
96,105c114,121
< $logbook = "HALOG";
< close(STDERR);
< open( STDERR, "/net/fs7/home/adaq/halog/log/dolog.log");
< $tmpdir = "$webmgr/log/tmp_html/";
< $htmldir = "$webmgr/log/html/";
< $logfile = "$webmgr/log/dolog.perl.log";
< $refdir = "log";
< $scrollname = "halog_selection";
< $LOGTITLE = "HALL A";
<
---
> # close(STDERR);
> # open( STDERR, "/usr/csite5/web/html/internal/halla/halog/dolog.log");
> # $tmpdir = "$webmgr/html/internal/halla/halog/tmp_html/";
> # $htmldir = "$webmgr/html/internal/halla/halog/html/";
> # $logfile = "$webmgr/html/internal/halla/halog/dolog.perl.log";
> # $refdir = "halla/halog";
> # $scrollname = "halog_selection";
> # $LOGTITLE = "HALL A";
120,129c136,143
< #$logbook = "HCLOG";
< # close(STDERR);
< # open( STDERR, "/net/fs7/home/cdaq/hclog/log/dolog.log");
< # $tmpdir = "$webmgr/log/tmp_html/";
< # $htmldir = "$webmgr/log/html/";
< # $logfile = "$webmgr/log/dolog.perl.log";
< # $refdir = "log";
< # $scrollname = "hclog_selection";
< # $LOGTITLE = "HALL C";
< #
---
> close(STDERR);
> open( STDERR, "/home/$logbook_account/$logbook_dirname/log/dolog.log");
> $tmpdir = "$webmgr/log/tmp_html/";
> $htmldir = "$webmgr/log/html/";
> $logfile = "$webmgr/log/dolog.perl.log";
> $refdir = "log";
> $scrollname = "$logbook_dirname_selection";
>
270c284,288
< @html_dirs=reverse sort grep( /...._archive$/, @html_array );
---
> #Begin Y2K Fix
> @html_dirs_the1990s=reverse sort grep( /9..._archive$/, @html_array );
> @html_dirs_newmillenium=reverse sort grep( /[0-8]..._archive$/, @html_array );
> @html_dirs = (@html_dirs_newmillenium,@html_dirs_the1990s);
> #End Y2K Fix
272a291
> #$html_archive = "9908_archive"; # Hack to fix Aug 1999.
302,305c321
< open( OUTFILE_AUTO, ">logdir_auto.new.html" );
< open( OUTFILE_AUTO2, ">logdir_auto2.new.html" );
< open( OUTFILE_NOAUTO, ">logdir_noauto.new.html" );
< open( OUTFILE_NOAUTO2, ">logdir_noauto2.new.html" );
---
> &print_logdirhead(OUTFILE,"full listing");
307,311c323,328
< &print_logdirhead(OUTFILE,"Full Listing");
< &print_logdirhead(OUTFILE_AUTO,"Run Ends Only");
< &print_logdirhead(OUTFILE_AUTO2,"Run Starts Only");
< &print_logdirhead(OUTFILE_NOAUTO,"Accounting Only");
< &print_logdirhead(OUTFILE_NOAUTO2,"All EXCEPT Automatic Entries");
---
> if($do_runstart_stuff) {
> open( OUTFILE_AUTO, ">logdir_auto.new.html" );
> open( OUTFILE_NOAUTO, ">logdir_noauto.new.html" );
> &print_logdirhead(OUTFILE_AUTO,"runstarts only");
> &print_logdirhead(OUTFILE_NOAUTO,"runstarts omitted");
> }
329a347,349
> # Local time returns (year-1900). Just keep the last tow digits since we only
> # use two digits of year in filenames. Fix this log book before 2090.
> $year %= 100;
351c371
< @html_array=grep( /$html_wildcard/, @html_array );
---
> @html_array=grep( /^$html_wildcard/, @html_array );
428,431c448,451
< printf( OUTFILE_AUTO "\n" );
< printf( OUTFILE_AUTO2 "\n" );
< printf( OUTFILE_NOAUTO "\n" );
< printf( OUTFILE_NOAUTO2 "\n" );
---
> if($do_runstart_stuff) {
> printf( OUTFILE_AUTO "\n" );
> printf( OUTFILE_NOAUTO "\n" );
> }
435,438c455,458
< print OUTFILE_AUTO $dayheader;
< print OUTFILE_AUTO2 $dayheader;
< print OUTFILE_NOAUTO $dayheader;
< print OUTFILE_NOAUTO2 $dayheader;
---
> if($do_runstart_stuff) {
> print OUTFILE_AUTO $dayheader;
> print OUTFILE_NOAUTO $dayheader;
> }
448c468,469
< if($KEYWORD=~/$auto_regexp/o) {
---
> if($do_runstart_stuff) {
> if($KEYWORD=~/$auto_regexp/o) {
450c471
< } elsif($KEYWORD=~/$auto_regexp2/o) {
---
> } else {
452,455c473
< } elsif($KEYWORD=~/$auto_regexp3/o) {
< print OUTFILE_AUTO2 $entry_line;
< } else {
< print OUTFILE_NOAUTO2 $entry_line;
---
> }
471c489,490
< if($KEYWORD=~/$auto_regexp/o) {
---
> if($do_runstart_stuff) {
> if($KEYWORD=~/$auto_regexp/o) {
473c492
< } elsif ($KEYWORD=~/$auto_regexp2/o) {
---
> } else {
475,478c494
< } elsif($KEYWORD=~/$auto_regexp3/o) {
< print(OUTFILE_AUTO2 "$followuplist");
< } else {
< print(OUTFILE_NOAUTO2 "$followuplist");
---
> }
483c499,500
< if($KEYWORD=~/$auto_regexp/o) {
---
> if($do_runstart_stuff) {
> if($KEYWORD=~/$auto_regexp/o) {
485c502
< } elsif($KEYWORD=~/$auto_regexp2/o) {
---
> } else {
487,490c504
< } elsif($KEYWORD=~/$auto_regexp3/o) {
< print(OUTFILE_AUTO2 "$followuplist");
< } else {
< print(OUTFILE_NOAUTO2 "$followuplist");
---
> }
514c528,532
< @html_dirs=grep( /...._archive$/, @html_array );
---
> #Begin Y2K Fix
> @html_dirs_the1990s=reverse sort grep( /9..._archive$/, @html_array );
> @html_dirs_newmillenium=reverse sort grep( /[0-8]..._archive$/, @html_array );
> @html_dirs = (@html_dirs_newmillenium,@html_dirs_the1990s);
> #End Y2K Fix
516,520d533
< print OUTFILE_AUTO "
\n";
< print OUTFILE_NOAUTO "
\n";
< print OUTFILE_AUTO2 "
\n";
< print OUTFILE_NOAUTO2 "
\n";
<
522,525d534
< print OUTFILE_AUTO "\n";
< print OUTFILE_NOAUTO "\n";
< print OUTFILE_AUTO2 "\n";
< print OUTFILE_NOAUTO2 "\n";
526a536,542
> if($do_runstart_stuff) {
> print OUTFILE_AUTO "
\n";
> print OUTFILE_NOAUTO "
\n";
> print OUTFILE_AUTO "\n";
> print OUTFILE_NOAUTO "\n";
< print OUTFILE_NOAUTO "
\n";
< print OUTFILE_AUTO2 "
\n";
< print OUTFILE_NOAUTO2 "
\n";
---
> if($do_runstart_stuff) {
> print OUTFILE_AUTO "
\n";
> print OUTFILE_NOAUTO "
\n";
> }
626,630d648
< &print_logdirtail(OUTFILE_AUTO);
< &print_logdirtail(OUTFILE_NOAUTO);
< &print_logdirtail(OUTFILE_AUTO2);
< &print_logdirtail(OUTFILE_NOAUTO2);
<
632,635d649
< close( OUTFILE_AUTO );
< close( OUTFILE_NOAUTO );
< close( OUTFILE_AUTO2 );
< close( OUTFILE_NOAUTO2 );
636a651,657
> if($do_runstart_stuff) {
> &print_logdirtail(OUTFILE_AUTO);
> &print_logdirtail(OUTFILE_NOAUTO);
> close( OUTFILE_AUTO );
> close( OUTFILE_NOAUTO );
> }
>
644,651c665,670
< unlink( "logdir_auto.html" );
< rename( "logdir_auto.new.html", "logdir_auto.html" );
< unlink( "logdir_noauto.html" );
< rename( "logdir_noauto.new.html", "logdir_noauto.html" );
< unlink( "logdir_auto2.html" );
< rename( "logdir_auto2.new.html", "logdir_auto2.html" );
< unlink( "logdir_noauto2.html" );
< rename( "logdir_noauto2.new.html", "logdir_noauto2.html" );
---
> if($do_runstart_stuff) {
> unlink( "logdir_auto.html" );
> rename( "logdir_auto.new.html", "logdir_auto.html" );
> unlink( "logdir_noauto.html" );
> rename( "logdir_noauto.new.html", "logdir_noauto.html" );
> }
653c672
< system( "/bin/chown cdaq $logdir.html" );
---
> system( "/bin/chown $logbook_account $logdir.html" );
698,699d716
< unlink( "logdir_auto.new.html" );
< unlink( "logdir_noauto.new.html" );
701,704c718,726
< open( OUTFILE_AUTO, ">logdir_auto.new.html" );
< open( OUTFILE_NOAUTO, ">logdir_noauto.new.html" );
< open( OUTFILE_AUTO2, ">logdir_auto2.new.html" );
< open( OUTFILE_NOAUTO2, ">logdir_noauto2.new.html" );
---
> &print_logdirmonthhead(OUTFILE,"full listing");
> if($do_runstart_stuff) {
> unlink( "logdir_auto.new.html" );
> unlink( "logdir_noauto.new.html" );
> open( OUTFILE_AUTO, ">logdir_auto.new.html" );
> open( OUTFILE_NOAUTO, ">logdir_noauto.new.html" );
> &print_logdirmonthhead(OUTFILE_AUTO,"runstarts only");
> &print_logdirmonthhead(OUTFILE_NOAUTO,"runstarts omitted");
> }
706,711d727
< &print_logdirmonthhead(OUTFILE,"Full Listing");
< &print_logdirmonthhead(OUTFILE_AUTO,"Run Ends Only");
< &print_logdirmonthhead(OUTFILE_AUTO2,"Run Starts Only");
< &print_logdirmonthhead(OUTFILE_NOAUTO,"Accounting Only");
< &print_logdirmonthhead(OUTFILE_NOAUTO2,"All EXCEPT Automatic Entries");
<
737a754
> # print "Working on $html_filename\n";
803c820
< system( "/bin/chown cdaq $html_filename*" );
---
> system( "/bin/chown $logbook_account $html_filename*" );
840,844c857,861
< printf( OUTFILE_AUTO "\n" );
< printf( OUTFILE_NOAUTO "\n" );
< printf( OUTFILE_AUTO2 "\n" );
< printf( OUTFILE_NOAUTO2 "\n" );
< }
---
> if($do_runstart_stuff) {
> printf( OUTFILE_AUTO "\n" );
> printf( OUTFILE_NOAUTO "\n" );
> }
> }
847,850c864,867
< print OUTFILE_AUTO $dayheader;
< print OUTFILE_NOAUTO $dayheader;
< print OUTFILE_AUTO2 $dayheader;
< print OUTFILE_NOAUTO2 $dayheader;
---
> if($do_runstart_stuff) {
> print OUTFILE_AUTO $dayheader;
> print OUTFILE_NOAUTO $dayheader;
> }
895,903c912,918
< if($KEYWORD=~/$auto_regexp/o) {
< print OUTFILE_AUTO $entry_line;
< } elsif($KEYWORD=~/$auto_regexp2/o) {
< print OUTFILE_NOAUTO $entry_line;
< } elsif($KEYWORD=~/$auto_regexp3/o) {
< print OUTFILE_AUTO2 $entry_line;
< } else {
< print OUTFILE_NOAUTO2 $entry_line;
< }
---
> if($do_runstart_stuff) {
> if($KEYWORD=~/$auto_regexp/o) {
> print OUTFILE_AUTO $entry_line;
> } else {
> print OUTFILE_NOAUTO $entry_line;
> }
> }
909c924,925
< if($KEYWORD=~/$auto_regexp/o) {
---
> if($do_runstart_stuff) {
> if($KEYWORD=~/$auto_regexp/o) {
911c927
< } elsif($KEYWORD=~/$auto_regexp2/o) {
---
> } else {
913,916c929
< } elsif($KEYWORD=~/$auto_regexp3/o) {
< print(OUTFILE_AUTO2 "$followuplist");
< } else {
< print(OUTFILE_NOAUTO2 "$followuplist");
---
> }
928,935d940
< unlink( "logdir_auto.html" );
< rename( "logdir_auto.new.html", "logdir_auto.html" );
< unlink( "logdir_noauto.html" );
< rename( "logdir_noauto.new.html", "logdir_noauto.html" );
< unlink( "logdir_auto2.html" );
< rename( "logdir_auto2.new.html", "logdir_auto2.html" );
< unlink( "logdir_noauto2.html" );
< rename( "logdir_noauto2.new.html", "logdir_noauto2.html" );
937c942
< system( "/bin/chown cdaq $logdir.html" );
---
> system( "/bin/chown $logbook_account $logdir.html" );
939,943d943
< printf( OUTFILE_AUTO "\n" );
< printf( OUTFILE_NOAUTO "\n" );
< printf( OUTFILE_AUTO2 "\n" );
< printf( OUTFILE_NOAUTO2 "\n" );
<
945d944
<
947,950c946,956
< close( OUTFILE_AUTO );
< close( OUTFILE_NOAUTO );
< close( OUTFILE_AUTO2 );
< close( OUTFILE_NOAUTO2 );
---
>
> if($do_runstart_stuff) {
> unlink( "logdir_auto.html" );
> rename( "logdir_auto.new.html", "logdir_auto.html" );
> unlink( "logdir_noauto.html" );
> rename( "logdir_noauto.new.html", "logdir_noauto.html" );
> printf( OUTFILE_AUTO "\n" );
> printf( OUTFILE_NOAUTO "\n" );
> close( OUTFILE_AUTO );
> close( OUTFILE_NOAUTO );
> }
1011c1017,1025
< system( "/bin/mv $tmpdir$root_filename.html $htmldir$archiveDir" );
---
> #Don't Move it here, rewrite it
> # system( "/bin/mv $tmpdir$root_filename.html $htmldir$archiveDir" );
> open(OUT,">$htmldir$archiveDir$root_filename.html");
> print OUT "$KEYWORD\n";
> close(OUT);
> system( "/bin/cat $tmpdir$root_filename.html >> $htmldir$archiveDir$root_filename.html" );
> open(OUT,">>$htmldir$archiveDir$root_filename.html");
> print OUT "\n";
> unlink "$tmpdir$root_filename.html";
1015c1029
< system( "/bin/chown cdaq $htmldir$archiveDir/$root_filename*" );
---
> system( "/bin/chown $logbook_account $htmldir$archiveDir/$root_filename*" );
1055,1056c1069,1071
<
< halog FAQ's+HOWTO \n";
---
>
> $logbook_dirname FAQ's+HOWTO \n";
> print $fh "$extraheader_html";
1062,1064c1077,1080
< print $fh qq{Scrollable logbook | \n};
< print $fh qq{Beam Accounting Only | \n};
< print $fh qq{All EXCEPT Automatic Entries | \n};
---
> print $fh qq{Scrollable logbook | \n};
> if($do_runstart_stuff) {
> print $fh qq{All except run starts | \n};
> }
1068,1070c1084,1086
< print $fh qq{Run Ends Only | \n};
< print $fh qq{Run Starts Only | \n};
< print $fh qq{Search Entries | \n};
---
> if($do_runstart_stuff) {
> print $fh qq{Run starts only | \n};
> }
1121a1138,1147
> print $fh qq{
>
> };
> print $fh "
\n";
1127,1129c1153,1158
< print $fh "Jochen Volmer
\n";
< print $fh "volmer\@cebaf.gov
\n";
< print $fh "(757) 269-5011\n";
---
> # print $fh "Jochen Volmer
\n";
> # print $fh "volmer\@cebaf.gov
\n";
> # print $fh "(757) 269-5195
\n";
> print $fh "Stephen A. Wood
\n";
> print $fh "saw\@jlab.org
\n";
> print $fh "(757) 269-7367
\n";
1132,1135d1160
<
<
<
<