FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Using Cron via PHP CLI Executable
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Using Cron via PHP CLI Executable [message #166695 is a reply to message #166694] Fri, 10 February 2012 20:42 Go to previous message
DaveQB is currently offline  DaveQB   Australia
Messages: 109
Registered: January 2006
Location: Sydney
Karma:
Senior Member

For those that are interested in this matter and have php on the CLI working.
For me to get this working I did this:

As I couldn't su t the web user I had to change some permissions to run cron.php in a cron job.

In <FUDforum data>/scripts/ I chmod'd a few files to (666 or Read + Write for all 3 levels) in the Admin Control panel (so as web user)

The log files from my jobs:

xmlagg.php_1.log
acp.php_3.log


Also in that folder make sure "cron.php" is executable by all too.

Then over in: <FUDforum data>/

errors/LAST_CRON_RUN


This file is touched when cron.php is run so the next time it is run it knows when it was last run.

So now with that set to 666 and cron.php executable by all any user can run cron.php
Not ideal but the only way without root access on the machine.

Then I added the job into the users crontab (I use vim but people might find nano easier, so..)

export EDITOR=nano crontab -e


The paste in:

0 * * * * /<FUDforum data>/scripts/cron.php


And also add to the top of that crontab

MAILTO=<my email address>


So now you get updates of when it runs. Ideal only email when something happens. So to prevent the "Nothing to run" email every hour I commented out line 67 in the cron.php file:
//echo date('d M Y H:i:s') .": Nothing to run.\n";


There, done!

[Updated on: Fri, 10 February 2012 20:43]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Anonymous access level
Next Topic: Edit Banner Theme Color
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 15:06:23 GMT 2024

Total time taken to generate the page: 0.03663 seconds