Using Cron via PHP CLI Executable [message #166020] |
Mon, 05 September 2011 07:22 |
|
Anik
Messages: 36 Registered: August 2011 Location: India
Karma: 0
|
Member |
|
|
Hello there,
i tried to schedule tasks via fud forums job panel,
when i put there /usr/bin/php or /usr/local/bin/php none of get worked..
so i looked to this page http://cvs.prohost.org/index.php/Job%20Administration%20System#PHP_CLI_Exec utable and run this command on ssh to find the path but it says that command not found..
is there any command to find th path of php cli?
or did i have to install anything manually using yum? if ys then how?
or if i want to schedule cron via my control panel (server) then what will be the command for this?
Regards,
|
|
|
|
|
|
Re: Using Cron via PHP CLI Executable [message #166695 is a reply to message #166694] |
Fri, 10 February 2012 20:42 |
DaveQB
Messages: 109 Registered: January 2006 Location: Sydney
Karma: 0
|
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>/
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
|
|
|