File:  [LON-CAPA] / loncom / build / Attic / CHECKRPMS.default
Revision 1.19: download - view: text, annotated - select for diffs
Wed Sep 1 16:28:26 2004 UTC (19 years, 9 months ago) by matthew
Branches: MAIN
CVS tags: version_2_2_X, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_1_3, version_2_1_2, version_2_1_1, version_2_1_0, version_2_0_X, version_2_0_99_1, version_2_0_2, version_2_0_1, version_2_0_0, version_1_99_3, version_1_99_2, version_1_99_1_tmcc, version_1_99_1, version_1_99_0_tmcc, version_1_99_0, version_1_3_X, version_1_3_3, version_1_3_2, version_1_3_1, version_1_3_0, version_1_2_X, version_1_2_99_1, version_1_2_99_0, version_1_2_1, HEAD
Damn that was stupid.  No way to get this in 1.2?

    1: #!/usr/bin/perl -w
    2: #
    3: # The LearningOnline Network with CAPA
    4: #
    5: # $Id: CHECKRPMS.default,v 1.19 2004/09/01 16:28:26 matthew Exp $
    6: #
    7: # Copyright Michigan State University Board of Trustees
    8: #
    9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   10: #
   11: # LON-CAPA is free software; you can redistribute it and/or modify
   12: # it under the terms of the GNU General Public License as published by
   13: # the Free Software Foundation; either version 2 of the License, or
   14: # (at your option) any later version.
   15: #
   16: # LON-CAPA is distributed in the hope that it will be useful,
   17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19: # GNU General Public License for more details.
   20: #
   21: # You should have received a copy of the GNU General Public License
   22: # along with LON-CAPA; if not, write to the Free Software
   23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24: #
   25: # /home/httpd/html/adm/gpl.txt
   26: #
   27: # http://www.lon-capa.org/
   28: #
   29: # (Navigate problems for statistical reports
   30: #
   31: 
   32: =pod
   33: 
   34: =head1 NAME
   35: 
   36: B<CHECKRPMS> - automated status report about RPMs on a system.
   37: 
   38: =head1 DESCRIPTION
   39: 
   40: Runs Martin Seigert's checkrpms script.  See 
   41: http://www.sfu.ca/acs/security/linux/check-rpms.html for more information.
   42: 
   43: Must be run as root or www.
   44: 
   45: =cut
   46: 
   47: use strict;
   48: use lib '/home/httpd/lib/perl/';
   49: use LONCAPA::Configuration;
   50: #
   51: # Determine who we email
   52: my %perlvar=%{LONCAPA::Configuration::read_conf('loncapa.conf')};
   53: my $emailto = "$perlvar{'lonAdmEMail'}";
   54: my $subj=$perlvar{'lonHostID'}.' rpm status';
   55: 
   56: my $checkrpms = '/usr/local/bin/check-rpms';
   57: #
   58: # Check that checkrpms is installed and is the proper version...
   59: my $mailmsg = '';
   60: if (! -e $checkrpms) {
   61:     $mailmsg = <<END;
   62: 
   63: Unable to locate check-rpms on your system.  Please go to 
   64: http://www.sfu.ca/acs/security/linux/check-rpms.html, download and 
   65: install check-rpms on this system.
   66: 
   67: END
   68: 
   69: }
   70: 
   71: #
   72: # Run check-rpms and capture its output
   73: $mailmsg = `$checkrpms`;
   74: 
   75: #
   76: # Email the user the output of checkrpms
   77: if ($mailmsg ne '') {
   78:     $mailmsg =<<"END";
   79: checkrpms checked the status of the packages on your system and 
   80: produced the following output:
   81: -------------------------------------------------------
   82: $mailmsg
   83: -------------------------------------------------------
   84: If there are rpms which need to be installed, please log into
   85: $perlvar{'lonHostID'} and run the following command
   86: 
   87: $checkrpms --update
   88: 
   89: If there are kernel packages to be installed, use
   90: 
   91: $checkrpms --update --install-kernel
   92: 
   93: Keeping your system up to date is very important.
   94: Ensuring you are using up to date software is a prerequisite for a 
   95: secure system.
   96: 
   97: END
   98:     my $mail_file = '/tmp/CHECKRPMS.'.$$;
   99:     open(MAILFILE,">$mail_file") || die("Unable to write to ".$mail_file);
  100:     print MAILFILE $mailmsg.$/;
  101:     close(MAILFILE);
  102:     my $mailcommand = "mail -s '$subj' $emailto <$mail_file";
  103:     print STDERR $mailcommand;
  104:     system($mailcommand);
  105: }
  106: 
  107: exit;

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