File:
[LON-CAPA] /
loncom /
cgi /
ping.pl
Revision
1.4:
download - view:
text,
annotated -
select for diffs
Tue Feb 25 20:50:31 2003 UTC (21 years, 7 months ago) by
www
Branches:
MAIN
CVS tags:
version_1_0_3,
version_1_0_2,
version_1_0_1,
version_1_0_0,
version_0_99_5,
version_0_99_4,
version_0_99_3,
version_0_99_2,
version_0_99_1,
version_0_99_0,
conference_2003,
HEAD
When doing the transition to LONCAPA::Configuration, there should not have
been a "my" in front of the perlvar hash.
#!/usr/bin/perl
# The LearningOnline Network with CAPA
# ping cgi-script
$|=1;
use lib '/home/httpd/lib/perl/';
use LONCAPA::Configuration;
use IO::File;
use IO::Socket;
my %perlvar;
# -------------------------------------------------- Non-critical communication
sub reply {
my ($cmd,$server)=@_;
my $peerfile="$perlvar{'lonSockDir'}/$server";
my $client=IO::Socket::UNIX->new(Peer =>"$peerfile",
Type => SOCK_STREAM,
Timeout => 10)
or return "con_lost";
print $client "$cmd\n";
my $answer=<$client>;
chomp($answer);
if (!$answer) { $answer="con_lost"; }
return $answer;
}
# --------------------- Read loncapa.conf (and by default loncapa_apache.conf).
my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf');
%perlvar=%{$perlvarref};
undef $perlvarref; # remove since sensitive and not needed
delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed
delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed
$testhost=$ENV{'QUERY_STRING'};
$testhost=~s/\W//g;
print "Content-type: text/plain\n\n".
&reply('ping',$testhost)."\n";
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>