I feel so stupid, but I and a co-worker have been staring at this for two hours, with 
no progress.

I'm trying to run some perl scripts which came with the system Cacti. One is 
webhits.pl:
centernet:/usr/local/httpd/htdocs/cacti8/scripts # cat webhits.pl
#!/usr/local/bin/perl

if ($ARGV[0] eq "") {
        $log_path = "/var/log/httpd/access_log";
}else{
        $log_path = $ARGV[0];
}

$webhits = `wc -l $log_path`;
$webhits =~ s/[\s]*([0-9]+).*//;

print $1;

centernet:/usr/local/httpd/htdocs/cacti8/scripts # 

I get this error if I run it alone, but not through perl:
centernet:/usr/local/httpd/htdocs/cacti8/scripts # ./webhits.pl
bash: ./webhits.pl: No such file or directory
centernet:/usr/local/httpd/htdocs/cacti8/scripts # perl ./webhits.pl
7907centernet:/usr/local/httpd/htdocs/cacti8/scripts # 

(The '7907' is the output.) It doesn't matter if I use the full path to the file or 
not. A similar script in the same directory runs fine without invoking perl on the 
command line:
7907centernet:/usr/local/httpd/htdocs/cacti8/scripts # cat weatherbug.pl
#!/usr/local/bin/perl 

$output = `/bin/bash -c 'wget --quiet -O - 
\"http:\/\/wisapidata.weatherbug.com\/WxDataISAPI\/WxDataISAPI.dll?Magic=10991&RegNum=3647055&ZipCode=17241&StationID=NWVLL&Units=0&Version=2.7&Fore=1&t=1015084854\/"'`;
 

$output =~ s/[%]|[°]|[n]|[s]|[r]|[f]//gi; 

@weather = split(/\|/, $output); 

# docs 
# [0] - ID? 
# [1] - Current Time 
# [2] - Current Date 
# [3] - Current Temperature 
# [5] - Wind Speed (MPH) 
# [7] - Gust Wind Speed (MPH) 
# [10] - Barometer (Moisture) 
# [11] - Humidity (%) 
# [12] - High Tempurature 
# [13] - Low Temperature 
# [14] - Dew Point 
# [15] - Wind Chill 

print "current_temp:" . $weather[3] . " wind_speed:" . $weather[5] . " barometer:" . 
$weather[10] . " humidity:" . 
        $weather[11] . " high_temp:" . $weather[12] . " low_temp:" . $weather[13] . " 
dew_point_temp:" . 
        $weather[14] . " wind_chill_temp:" . $weather[15];
centernet:/usr/local/httpd/htdocs/cacti8/scripts # ./weatherbug.pl
current_temp:77 wind_speed:0 barometer:30.12 humidity:72 high_temp:78 low_temp:64 
dew_point_temp:68 wind_chill_temp:80centernet:/usr/local/httpd/htdocs/cacti8/scripts # 

The she-bang line seems correct, and in any case, it's the same between the two files:
centernet:/usr/local/httpd/htdocs/cacti8/scripts # which perl
/usr/local/bin/perl
centernet:/usr/local/httpd/htdocs/cacti8/scripts # head -1 webhits.pl weatherbug.pl
==> webhits.pl <==
#!/usr/local/bin/perl

==> weatherbug.pl <==
#!/usr/local/bin/perl 
centernet:/usr/local/httpd/htdocs/cacti8/scripts # 

There don't seem to be any invisible characters in the name, and the permissions seem 
fine:
centernet:/usr/local/httpd/htdocs/cacti8/scripts # ls -lb w*
-rwxr-xr-x    1 cactiuse webadmin      899 Aug 12 09:54 weatherbug.pl
-rwxr-xr-x    1 cactiuse webadmin      791 Jun 12 16:06 weatherbug.pl.orig
-rwxr-xr-x    1 cactiuse webadmin      208 Aug 12 10:28 webhits.pl
centernet:/usr/local/httpd/htdocs/cacti8/scripts # 

I'm stumped. Can anyone point out the boneheaded mistake I'm making?

Thanks for your help.

-Kevin Zembower


-----
E. Kevin Zembower
Unix Administrator
Johns Hopkins University/Center for Communications Programs
111 Market Place, Suite 310
Baltimore, MD  21202
410-659-6139


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to