Annotation of loncom/build/install_web_site_cronjob, revision 1.3

1.1       harris41    1: #!/usr/bin/perl
                      2: 
                      3: =pod
                      4: 
                      5: =head1 NAME
                      6: 
                      7: install_web_site_cronjob - maintain install.lon-capa.org web-site every day
                      8: 
                      9: =head1 DESCRIPTION
                     10: 
                     11: This is a file that runs periodically on B<install.lon-capa.org>.
                     12: 
                     13: This file should be run by the 'loninst' user and be part of
                     14: the 'loninst' crontab entries (to view loninst crontab, login
                     15: as loninst and crontab C<-l>; to edit loninst crontab, login as
                     16: loninst and crontab C<-e>).
                     17: 
                     18: This file should be on the B<install.lon-capa.org> filesystem as
1.2       harris41   19: F</home/loninst/auto/install_web_site_cronjob>.
1.1       harris41   20: 
                     21: The current 'loninst' crontab entry is:
                     22: 
1.2       harris41   23: 13 16 * * *    /home/loninst/auto/install_web_site_cronjob
1.1       harris41   24: 
1.2       harris41   25: The main goal of B<install_web_site_cronjob> is to periodically produce the
1.3     ! albertel   26: unstable tarball needed for LON-CAPA installation.
1.1       harris41   27: 
1.2       harris41   28: A secondary yet important function of B<install_web_site_cronjob> is that it
1.1       harris41   29: also refreshes the documentation present on the install.lon-capa.org
                     30: web site.
                     31: 
1.3     ! albertel   32: It does depend on a file name LATEST-IS-something, where something is
        !            33: the latest release of loncapa, that file should also contain a string
        !            34: that will be used to date the release.
        !            35: 
1.1       harris41   36: The coding of this script is a strange brew of shell commands
                     37: with perl.
                     38: 
                     39: =head1 AUTHOR
                     40: 
                     41: Scott Harrison 2002-07-19
                     42: 
                     43: =cut
                     44: 
                     45: # --------------------------------------------- Making the tarball distribution
1.3     ! albertel   46: #`cd /home/loninst/auto; export CVS_PASSFILE=/home/loninst/.cvspass; export CVSROOT=:pserver:scott\@localhost:/home/cvs; rm -Rf loncapa/[C][^V]*; rm -Rf loncapa/[^C]*; cvs -Q co loncapa; cd loncapa/loncom/build; make build 2>/dev/null; make tardist;`;
        !            47: `cd /home/loninst/auto; export CVS_PASSFILE=/home/loninst/.cvspass; export CVSROOT=:pserver:scott\@localhost:/home/cvs; rm -Rf loncapa-unstable; rm -Rf loncapa; cvs -Q export -r HEAD loncapa; ln -s loncapa loncapa-unstable; tar cvvf loncapa-unstable.tar loncapa-unstable/* ;gzip -9 -f loncapa-unstable.tar`;
1.1       harris41   48: # ---------------------------------------- Dynamically generating documentation
                     49: `cd /home/loninst/auto/loncapa/loncom/build; make pdfdoc`;
                     50: `cd /home/loninst/auto/loncapa/loncom/build; make doc`;
                     51: `cd /home/loninst/auto/loncapa/loncom/build; cp docs.tar.gz /home/loninst/public_html/docs/.`;
                     52: `cd /home/loninst/public_html/docs; tar xzf docs.tar.gz`;
                     53: 
                     54: # ------------------------------------ Copying over the latest unstable tarball
1.3     ! albertel   55: #my $filename=`cd /home/loninst/auto; find loncapa -type f -name *.tar.gz -maxdepth 1`;
        !            56: #chomp($filename);
        !            57: #$filename=~/loncapa\/loncapa\-(.*?)\.tar\.gz/;
        !            58: #my $version=$1;
        !            59: `cd /home/loninst/auto; cp -f loncapa-unstable.tar.gz ../public_html/versions/loncapa-unstable.tar.gz`;
        !            60: #`cd /home/loninst/public_html/versions; rm -f loncapa-unstable.tar.gz; ln -s loncapa-$version-unstable.tar.gz loncapa-unstable.tar.gz`;
        !            61: 
        !            62: #get latest version
        !            63: my $filename=`cd /home/loninst/public_html/versions; find . -type f -name LATEST-IS-* -maxdepth 1`;
1.1       harris41   64: chomp($filename);
1.3     ! albertel   65: $filename=~/LATEST-IS-(.*)/;
1.1       harris41   66: my $version=$1;
1.3     ! albertel   67: open(IN,"</home/loninst/public_html/versions/$filename");
        !            68: my $releasedate=<IN>;
        !            69: close(IN);
1.1       harris41   70: # ------------------ Updating the download page with the date of the last build
                     71: open(IN,"</home/loninst/public_html/docs/downloads/index.html");
                     72: my @lines=<IN>;
                     73: close(IN);
                     74: my $date=`date -I`; chomp($date);
                     75: my $text=join('',@lines);
                     76: $text=~s/loncapa-unstable\.tar\.gz\<\/a\>.*?\./loncapa-unstable\.tar\.gz\<\/a\> (generated $date)\./;
1.3     ! albertel   77: $text=~s/LATESTVERSION/$version/g;
        !            78: $text=~s/LATESTDATE/$releasedate/g;
1.1       harris41   79: open(OUT,">/home/loninst/public_html/docs/downloads/index.html");
                     80: print(OUT $text);
                     81: close(OUT);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>