Help with Cron job

Help with Cron job

Posted by: alderyarrow
Posted on: 2006-05-21 12:23:00

Howdy.

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 /<pathtomydirector>/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/Bootstrap.pm 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 /<mydomainpath>//tools/run-periodic-tasks line 11.
BEGIN failed--compilation aborted at /<mydomainpath>/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.


Re: Help with Cron job

Posted by: matttail
Posted on: 2006-05-21 15:00:00

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/example.com/MT/; ./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
art.googlies.net - personal website
Edited by matttail on 05/21/06 03:02 PM (server time).

Re: Help with Cron job

Posted by: alderyarrow
Posted on: 2006-05-21 17:48:00

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!

Tags: cron jobperl scriptmovable typehowdyusrlocalhelp