--- loncom/build/CHECKRPMS 2011/10/17 19:11:42 1.14 +++ loncom/build/CHECKRPMS 2011/10/19 03:21:29 1.15 @@ -3,7 +3,7 @@ # The LearningOnline Network with CAPA # Checks status of RPM packages on system. # -# $Id: CHECKRPMS,v 1.14 2011/10/17 19:11:42 raeburn Exp $ +# $Id: CHECKRPMS,v 1.15 2011/10/19 03:21:29 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -85,6 +85,12 @@ open(TMPFILE,">$tmpfile"); print TMPFILE localtime(time).' '.$hostname."\n"; close(TMPFILE); +if ($docroot ne '') { + if (-e "$docroot/lon-status/checkrpms.txt") { + unlink("$docroot/lon-status/checkrpms.txt"); + } +} + my ($cmd,$send,$addsubj); if ($distro =~ /^fedora\d+$/) { $cmd = 'yum update'; @@ -145,6 +151,10 @@ if ($send) { $subj .= $addsubj; if ($docroot ne '') { system("cat $tmpfile > $docroot/lon-status/checkrpms.txt"); + if ($< == 0) { + system("chown www:www $docroot/lon-status/checkrpms.txt"); + } + chmod(0600,$docroot/lon-status/checkrpms.txt"); } system(qq{mail -s '$subj' "$emailto" < $tmpfile}); }