Not a perl expert but does the print print out to stdout? If so, maybe (just maybe) it doesn't like that since cron doesn't have a tty attached (really just guessing). If you want to get a feel of what is causing the problem though, just comment out sections of code and run it until you can isolate what line is causing the server error - I'd start with the whole script commented out. That way you
can eliminate permissions etc before delving into the perl itself.

Maybe no-one else is using this as a cronjob which is why they are not seeing problems.

Regards

Neill

Chris wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've got a very simple perl script that I'm trying to run as a cronjob.
#!/usr/bin/perl

use LWP::Simple qw(mirror $ua);

$| = 1;

$ua->timeout(60);
my $url = 'http://www.sanesecurity.com/clamav/phish.ndb.gz';
my $file = 'phish.ndb.gz';
my $dbfile = 'phish.ndb';

my $result = mirror($url, $file);
print "$file\t$result\n";
if ($result == 200) {
  system "gunzip -v --stdout $file > $dbfile";
}
exit 0;

Its use is to check for new updates to the phish.ndb file used by clamav. It runs fine from the cli so I know there is no issue with the script, however, when attempting to run as a cronjob I get:

phish.ndb.gz    500

which I'm told by the author is a

A 500 status code is an internal server error. Nothing to do with the script.

He also goes on to say:

"99% of all problems under Unix are permissions"

Aside from it being under cron, what else is different. UserID, evnironment, shell, PWD, etc ?

All my other cronjobs run correctly. Below is my crontab and permission settings for /usr/local/bin/Phish.pl

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
[EMAIL PROTECTED]
HOME=/
# run-parts
1 * * * *       root    nice -n 19 run-parts /etc/cron.hourly
2 * * * *       clamav  /usr/local/bin/freshclamcron
0 * * * *       root    /usr/local/etc/logcheck.sh
33 21 * * *     chris   /usr/local/bin/Phish.pl

# 2 4 * * * root nice -n 19 run-parts /etc/cron.daily # 22 4 * * 7 root nice -n 19 run-parts /etc/cron.weekly # 42 4 1 * * root nice -n 19 run-parts /etc/cron.monthly

Permissions are set as below:

[EMAIL PROTECTED] bin]# ls -lr Phish.pl
- -rwxrwxr-x  1 root root 331 Apr 26 18:56 Phish.pl*

Whether running this job as root or chris nets the same output. Any suggestions or help would be much appreciated.

- -- Chris
Registered Linux User 283774 http://counter.li.org
19:58:13 up 6 days, 23:42, 1 user, load average: 1.91, 0.75, 0.36
Mandriva Linux 10.1 Official, kernel 2.6.8.1-12mdk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When the pin is pulled, Mr Grenade is not your friend.
                -- Murphy's New Military Laws n°1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFEUWqW43Kn2pjmcFwRAq6KAKCAh4eqM6vPeGeveexFqRL0HEwKjQCePUgV
JDw4NeJR62TNf3FR+OAE1K4=
=GBDA
-----END PGP SIGNATURE-----
____________________________________________________
Want to buy your Pack or Services from Mandriva? Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________

Send instant messages to your online friends http://uk.messenger.yahoo.com ____________________________________________________ Want to buy your Pack or Services from Mandriva? Go to http://store.mandriva.com
Join the Club : http://www.mandrivaclub.com
____________________________________________________

Reply via email to