Annotation of loncom/build/CHECKRPMS.fedora, revision 1.1
1.1 ! matthew 1: #!/usr/bin/perl -w
! 2: #
! 3: # The LearningOnline Network with CAPA
! 4: #
! 5: # $Id: lonstatistics.pm,v 1.107 2004/06/24 19:36:16 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, Yum version.
! 37:
! 38: =head1 DESCRIPTION
! 39:
! 40: This file automates the usage of yum to check for available updates
! 41: to Fedora systems.
! 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: my $yum = '/usr/bin/yum';
! 52: my $tmpfile = '/tmp/CHECKRPMS.'.$$;
! 53: my $command = 'date>'.$tmpfile.';'.$yum.' check-update '.'>>'.$tmpfile;
! 54:
! 55: #
! 56: # Determine who we email
! 57: my %perlvar=%{LONCAPA::Configuration::read_conf('loncapa.conf')};
! 58: my $emailto = "$perlvar{'lonAdmEMail'}";
! 59: my $subj=$perlvar{'lonHostID'};
! 60: undef(%perlvar);
! 61:
! 62: #
! 63: # Execute yum command
! 64: system($command);
! 65:
! 66: my $returnvalue = $?>>8;
! 67:
! 68: #
! 69: # Determine status of yum run
! 70: if (100 == $returnvalue) {
! 71: $subj.= ' RPMS to upgrade';
! 72: # Send email
! 73: system(qq{mail -s '$subj' $emailto < $tmpfile});
! 74: } elsif (0 != $returnvalue) {
! 75: # Send email
! 76: $subj.= ' Error running RPM update script';
! 77: system(qq{mail -s '$subj' $emailto < $tmpfile});
! 78: } else {
! 79: # yum returned 0, so everything is up to date.
! 80: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>