Annotation of loncom/build/CHECKRPMS.default, revision 1.19
1.18 matthew 1: #!/usr/bin/perl -w
2: #
3: # The LearningOnline Network with CAPA
4: #
1.19 ! matthew 5: # $Id: CHECKRPMS.default,v 1.18 2004/08/25 14:44:32 matthew Exp $
1.18 matthew 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: #
1.1 harris41 31:
1.2 harris41 32: =pod
33:
34: =head1 NAME
35:
1.18 matthew 36: B<CHECKRPMS> - automated status report about RPMs on a system.
1.2 harris41 37:
1.8 harris41 38: =head1 DESCRIPTION
1.2 harris41 39:
1.18 matthew 40: Runs Martin Seigert's checkrpms script. See
41: http://www.sfu.ca/acs/security/linux/check-rpms.html for more information.
1.2 harris41 42:
1.18 matthew 43: Must be run as root or www.
1.2 harris41 44:
45: =cut
46:
1.18 matthew 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';
1.7 harris41 55:
1.18 matthew 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;
1.2 harris41 62:
1.18 matthew 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.
1.1 harris41 66:
67: END
1.7 harris41 68:
1.18 matthew 69: }
1.7 harris41 70:
1.18 matthew 71: #
72: # Run check-rpms and capture its output
73: $mailmsg = `$checkrpms`;
1.7 harris41 74:
1.18 matthew 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: }
1.7 harris41 106:
1.18 matthew 107: exit;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>