/ /etc/hosts unless (-e '') # Does file exist? { print("**** ERROR **** Missing \n"); } else { my $numentries = `grep -v '^#' | grep -c '[[:alpha:]]'`; if ($numentries == 1) { print("**** ERROR **** Malformatted \n"); print(" typically should have at least two entries, ". "e.g.:\n"); print("127.0.0.1 localhost.localdomain localhost\n"); print("35.8.63.26 s16.lite.msu.edu s16\n"); print("The file on your machine looks like it was \n". "messed up due to a common bug with RedHat installations.\n". "(This weird bug is RedHat's fault, not LON-CAPA's.)\n"); print("Please read the man pages about \"hosts\" and fix your\n". " file.\n"); } } /var/lib/mysql/mysql.sock unless (-e '') # Does file exist? { print("**** ERROR **** Missing \n"); } /etc/httpd/conf/loncapa.conf /etc/httpd/loncapa.conf /etc/apache2/loncapa.conf open IN, "<"; my $hbug=-1; my $dbug=-1; while (<IN>) { if (/PerlSetVar\s+lonHostID\s+(\S+)/) { my $v=$1; $hbug=0; $hbug=1 if $v=~/\W/; $hbug=1 if $v=~/\_/; } if (/PerlSetVar\s+lonDefDomain\s+(\S+)/) { my $v=$1; $dbug=0; $dbug=1 if $v=~/\W/; $dbug=1 if $v=~/\_/; # Avoid namespace conflicts under the web server's DocumentRoot. my @badnames=('raw','userfiles','priv','adm','uploaded'); foreach my $bad (@badnames) { $dbug=1 if $v eq $bad; } } } if ($hbug) { print "**** ERROR **** has invalid lonHostID\n"; } if ($dbug) { print "**** ERROR **** has invalid lonDefDomain\n"; } /home/httpd/lonTabs/hosts.tab open IN, "<"; my $rbug=0; my $dbug=0; my $sbug=0; my $fbug=0; while (<IN>) { next if (/^(\#|\s*$)/); if (/\S/) { $rbug=1 if /\r/; my @a=split(/\:/,$_); $dbug=1 if $a[0]=~/\W/; $dbug=1 if $a[0]=~/\_/; $dbug=1 if $a[1]=~/\_/; $dbug=1 if $a[1]=~/\W/; $fbug=1 if (@a<4 || @a>5); my $expr='\s.+$'; $sbug=1 if ($a[0] =~ /$expr/ || $a[1] =~ /$expr/ || $a[2] =~ /$expr/ || $a[3] =~ /$expr/ ) ; } } close IN; if ($rbug) { print "**** ERROR **** is DOS-formatted\n"; } if ($dbug) { print "**** ERROR **** has invalid host id or domain id\n"; } if ($fbug) { print "**** ERROR **** is lacking 4 or 5 columns for every row\n"; } if ($sbug) { print "**** ERROR **** has illegal whitespace character\n"; } /home/httpd/lonTabs/spare.tab open IN, "<"; my $rbug=0; my $dbug=0; my $sbug=0; while (my $line = <IN>) { if ($line =~ /\S/) { $rbug=1 if $line=~/\r/; if ($line =~ /\W.*\n/) { $dbug=$line if ($line !~/\w:(?:primary|default)$/); } $dbug=$line if $line=~/\_/; $sbug=1 if $line=~/\s.+$/; } } close IN; if ($rbug) { print "**** ERROR **** is DOS-formatted\n"; } if ($dbug) { print "**** ERROR **** has invalid host id ($dbug)\n"; } if ($sbug) { print "**** ERROR **** has illegal whitespace character\n"; }