*BSD News Article 74309


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.kei.com!newsfeed.internetmci.com!news.probe.net!news.llv.com!news
From: ross@rossfleege.com (Ross Fleege)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Script works in shell - not on Web
Date: Fri, 19 Jul 1996 22:11:44 GMT
Organization: LogonLasVegas by SoftFacts, Inc.
Lines: 39
Message-ID: <4sp14k$6au@sahara.llv.com>
NNTP-Posting-Host: dial201.nconnect.net
X-Newsreader: Forte Free Agent 1.0.82

I have a few scripts that run perfectly in shell, but say "Server
Error" when I run them on the web.  I chmod'ed them to 755.  They
still won't work.  They are all in my cgi-bin directory, so they
should execute.  The server is Apache and I am running a virtual
domain.  Any suggestions?  Here's a script I have that works fine in
shell but doesn't work on the Web.

#!/usr/bin/perl

print "Content-type: text/html", "\n\n";

$username = 'rfleege';

print "<HTML>\n <HEAD>\n <TITLE>Finger Me</TITLE>\n </HEAD>\n
<BODY>\n";

open(FINGER, "/usr/bin/finger $username |");

for(<FINGER>){
  ($word1,$word2,$day,$month,$date,$time)  = split(/\s+/,$_);

  if(($word1 eq 'Last')&&($word2 eq 'login')){
    print "I'm currently not online. The last time I was was: \n";
    print "$day $month $date $time\n</BODY>\n </HTML>\n";
    close (FINGER);
    exit;

  }elsif(($word1 eq 'On')&&($word2 eq 'since')){
    print "I'm currently on line and have been since: \n";
    print "$day $month $date $time\n </BODY>\n </HTML>\n";
    close (FINGER);

    exit;
  }
}

Ross Fleege
ross@rossfleege.com