Script works manually, but not as cron job?


#1

Hello,

I have a MovableType blog installed on my webspace, as well as the Pop2Blog plugin which checks a POP mailbox for emails and posts them to the blog. The plugin seems to be working perfectly as long as I execute the script manually, but as soon as I call it using a cron job, it doesn’t work.

This is the content of my crontab file:

0 3 * * * perl /home/username/awstats/awstats_buildstaticpages.pl -config=fereveldir -update -awstatsprog=/home/username/awstats/awstats.pl -dir=/home/username/fereveldir.pointy-ears.net/awstats/
30 * * * * perl /home/username/the-witch/pop2blog.pl

(the first line rebuilds a statistics page, never had any problems with it)

With that setup, it emails me the following message every time the cron job is executed:
“ERROR: Don’t know which folder I should open: no name.
Can’t call method “messages” on an undefined value at /home/username/the-witch/pop2blog.pl line 52.”

But when I just copy & paste the very same command I have in my crontab file, it executes perfectly. I’d appreciate any ideas on why this is happening, I haven’t used cron jobs much before but I didn’t think there would be any difference from executing scripts manually or automatically…? Thanks!


#2

Aha! I poked around in the script a bit and found that one Perl module it uses requires the environment variable MAIL to be set. It works now, thanks alot! :slight_smile: