Running a cron job for DownloadMail Plugin

By Christopherb - July 30, 2010 - edited: July 30, 2010

We are having trouble running a cron job for the DownloadMail Plugin.

The path is
/home/www/jackson/cmsAdmin/plugins/downloadMail/run.php

When the cron runs, we get the following error:

PHP Warning: require_once(../../lib/init.php): failed to open stream: No such file or directory in /home/www/jackson/cmsAdmin/plugins/downloadMail/run.php on line 4
PHP Fatal error: require_once(): Failed opening required '../../lib/init.php' (include_path='.:') in /home/www/jackson/cmsAdmin/plugins/downloadMail/run.php on line 4

From within the cmsAdmin the script runs fine...

Re: [Christopherb] Running a cron job for DownloadMail Plugin

By Jason - August 2, 2010

Hi,

Even though it's producing an error, does it still download the emails?

If not, you can try to replace the path in run.php with the complete url to init.php, It would probably look something like this:

require_once("http://www.yourdomain.com/cmsAdmin/lib/init.php");

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Running a cron job for DownloadMail Plugin

Hi Jason,

Got it to work with the full path.

Changed:

../../lib/init.php

to

/home/www/jackson/cmsAdmin/cmsAdmin/lib/init.php

Hope this helps someone else too...

Thanks,

Chris

Re: [Christopherb] Running a cron job for DownloadMail Plugin

Hi, Folks -

I'm new to this plugin and encountered a similar problem as Chris.

I could only get the cron job to run by prefixing the path with:
/usr/bin/php -q
The final command line looked something like this....
/usr/bin/php -q /my/path/to/plugins/downloadMail/run.php

Hope this helps too!

:0)

Perch

Re: [Dave] Running a cron job for DownloadMail Plugin

So I have some questions about this plugin, I have the archiving function working fine and I have the incoming mail displaying correctly in the section. However I'm thinking I missed something because it doesn't pull mail automatically, every time I want new mail I have to click the plugin download mail button. I tried using a cron job to run this but it's not updating, if I set the cron to email it works but doesn't display any information it tells me: Security Check - Edit run.php and remove this error before you use it. In the body of the email. The cron script I'm running is this:

/usr/bin/php -q /home/shaftsan/public_html/admin/plugins/downloadMail/run.php

I also updated the run.php to use the absolute URL and it still doesn't work.

Any insight would be awesome

Re: [Hybrid] Running a cron job for DownloadMail Plugin

By Dave - April 13, 2011

Hi Hybrid,

By default run.php won't work unless you disable the security check. We add this to a lot of our example pages so people aren't allowing code to run without knowing what it's for.

The solution is to edit run.php and remove the security check error. It looks like this:

die("Security Check - Edit run.php and remove this error before you use it.");

Just remove that line or put a comment # in front of it.

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Running a cron job for DownloadMail Plugin

Thanks Dave, that did it! lol Can't believe I missed it. You gotta love how fast the CMSB forums work :)