Script works manually, but not as cron job?


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/ -config=fereveldir -update -awstatsprog=/home/username/awstats/ -dir=/home/username/
30 * * * * perl /home/username/the-witch/

(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/ 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!

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: