Help with Cron job



I’m trying to set up a Cron job to run a perl script in order to enable scheduled posting on a Movable Type implementation.

My cron job looks like this:

0,15,30,45 * * * * /usr/local/bin/perl //tools/run-periodic-tasks

Where “run-periodic-tasks” is an executable perlscript

If I’m on the shell and sitting in the tools directory and I type the command that is in the cron job above, the script executes fine.

However with the cron job set up as it is, I get the following error:

Can’t locate MT/ in @INC (@INC contains: lib …/lib /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ///tools/run-periodic-tasks line 11.
BEGIN failed–compilation aborted at //tools/run-periodic-tasks line 11.

Does this happen because cron is running on the system as some other sort of user as opposed to me? why would I be able to execute the script without a problem but cron can’t?

Thanks for your thoughts.


Try this command instead. I do scheduled postings, and this is what I use… thought the command came straight out of the MT manual.

*/15 * * * * cd /home/user/; ./tools/run-periodic-tasks > /dev/null

That all needs to appear on one line - make sure it doesn’t wrap. the “> dev/null” part just sends error messages to the bit bucket.

Edit: Oh yeah. The */15 works the same as what you have, running the command every 15 min, this way just takes less typing.

–Matttail - personal website


Mattail, I tried that syntax originally without success, but copying your code seems to have worked, so I likely just missed something small.

I sincerely appreciate the assistance!