version 1.27, 2001/03/27 20:08:23
|
version 1.33, 2001/04/16 18:36:22
|
Line 23 sub wanted {
|
Line 23 sub wanted {
|
push(@metalist,"$dir/$_"); |
push(@metalist,"$dir/$_"); |
} |
} |
|
|
|
|
$childmaxattempts=10; |
$childmaxattempts=10; |
$run =0;#running counter to generate the query-id |
$run =0;#running counter to generate the query-id |
|
|
Line 39 while ($configline=<CONFIG>) {
|
Line 38 while ($configline=<CONFIG>) {
|
} |
} |
close(CONFIG); |
close(CONFIG); |
|
|
|
# ------------------------------------- Make sure that database can be accessed |
|
{ |
|
my $dbh; |
|
unless ( |
|
$dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0}) |
|
) { |
|
print "Cannot connect to database!\n"; |
|
exit; |
|
} |
|
else { |
|
$dbh->disconnect; |
|
} |
|
} |
|
|
# --------------------------------------------- Check if other instance running |
# --------------------------------------------- Check if other instance running |
|
|
my $pidfile="$perlvar{'lonDaemons'}/logs/lonsql.pid"; |
my $pidfile="$perlvar{'lonDaemons'}/logs/lonsql.pid"; |
Line 60 while ($configline=<CONFIG>) {
|
Line 73 while ($configline=<CONFIG>) {
|
chomp($ip); |
chomp($ip); |
|
|
$hostip{$ip}=$id; |
$hostip{$ip}=$id; |
|
|
if ($id eq $perlvar{'lonHostID'}) { $thisserver=$name; } |
if ($id eq $perlvar{'lonHostID'}) { $thisserver=$name; } |
|
|
$PREFORK++; |
$PREFORK++; |
Line 191 sub make_new_child {
|
Line 203 sub make_new_child {
|
#open database handle |
#open database handle |
# making dbh global to avoid garbage collector |
# making dbh global to avoid garbage collector |
unless ( |
unless ( |
$dbh = DBI->connect("DBI:mysql:loncapa","www","123",{ RaiseError =>0,PrintError=>0}) |
$dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0}) |
) { |
) { |
my $st=120+int(rand(240)); |
sleep(10+int(rand(20))); |
&logthis("<font color=blue>WARNING: Couldn't connect to database ($st secs): $@</font>"); |
&logthis("<font color=blue>WARNING: Couldn't connect to database ($st secs): $@</font>"); |
print "database handle error\n"; |
print "database handle error\n"; |
sleep($st); |
|
exit; |
exit; |
|
|
}; |
}; |
Line 251 sub make_new_child {
|
Line 262 sub make_new_child {
|
} |
} |
} |
} |
# do custom metadata searching here and build into result |
# do custom metadata searching here and build into result |
if ($custom) { |
if ($custom or $customshow) { |
&logthis("am going to do custom query for $custom"); |
&logthis("am going to do custom query for $custom"); |
if ($query) { |
if ($query) { |
@metalist=map {$perlvar{'lonDocRoot'}.$_.'.meta'} @files; |
@metalist=map {$perlvar{'lonDocRoot'}.$_.'.meta'} @files; |
Line 352 sub reply {
|
Line 363 sub reply {
|
} |
} |
} else { |
} else { |
$answer='self_reply'; |
$answer='self_reply'; |
|
$answer=subreply($cmd,$server); |
} |
} |
return $answer; |
return $answer; |
} |
} |