#!/usr/local/bin/perl -w # # Original version: Karen Kenny # # Multi-server version: J.E. Fritz # # Changes: # # 1-Feb-1995 Use vanilla 5.001m Socket.pm # # 20-Nov-1997 Eliminate opal, add hercules # # 22-Jan-1999 Eliminate griffin/sphinx/cyclops add xena, physio # %::hosts= ('electro.psi.vcu.edu' => 5010, 'physio.psi.vcu.edu' => 5010, 'hercules.vcu.edu' => 1, 'xena.vcu.edu' => 1); my $defaulthost= 'hercules.vcu.edu'; use strict; chdir '/tmp'; sub abandon; # Print headers and flush buffer BEGIN {$|= 1; print "Content-type: text/html\r\n\r\n"; $!= 0} close(STDERR); open(STDERR,">&".fileno(STDOUT)); my $opcode= $ENV{'PATH_INFO'} || '/print_form'; if ($opcode eq '/print_form') { &print_form; } elsif ($opcode eq '/process_form') { &process_form; } elsif ($opcode eq '/load_average') { &load_average; } else {abandon("Sorry, unknown request type: $opcode.")} exit; sub print_form { my $localhost = `hostname`; chop $localhost; my ($h,@opt,$found_local); $found_local= 0; foreach $h (keys(%::hosts)) { if ($h eq $localhost) { $found_local= 1; push(@opt,'