View Full Version : running the cron
nabeel
12-05-2007, 03:10 PM
Hey,
Now that we have the blanket authentication working with our sign-on, we've run into another problem - the cron job accessing index.php/cron can't get through.
Is there a way to just run this locally, ie in the shell.
php -f index.php ...
Something to that extent?
Thanks.
jstanden
12-05-2007, 09:27 PM
Hey there!
You could just exclude a couple URIs in that bootloader hack we did for you.
Inside index.php (in your custom SSO logic, but before doing the login), do something like:
if(0 == strcasecmp($request->path[0],'cron')
|| 0 == strcasecmp($request->path[0],'update'))
break;
jstanden
12-05-2007, 09:31 PM
And yeah, you can run the cron from the console, but it'll have the same issue with the controller/SSO if you don't patch it.
The ideal way to do that is with wget/lynx:
http://www.cerberusweb.com/kb/article/000029
You *could* write a cron.php page that just invokes the ChCronController, but it shouldn't be necessary.
nabeel
12-06-2007, 02:15 PM
Hmm, okay, I'm still having some trouble with it. It's because the parameter is not being passed.
I'm running it from the php command line interpreter. Our single sign-on is blanket, covering even localhost.
Looking at the source, this should work:
php -f index.php -cron
Not working out so well though.
I'm tryna to see if I can punch a hole in the auth for index.php/cron, but doesn't seem likely.
Any other suggestions?
nabeel
12-06-2007, 03:57 PM
Ok, I ended up writing a custom "cron.php" that will call the Cronjob controller etc. If you would like me to send you the source I can.
It'll run at:
/usr/bin/php -f /path/to/cerberus/cron.php
It gives an error:
PHP Warning: array_shift(): The argument should be an array in /var/www/html/cerberus/libs/devblocks/api/Engine.php on line 229
But it doesn't affect the cron itself running. We didn't really care about the output/errors, just directed it to null.
Thanks!
jstanden
12-07-2007, 05:15 AM
Hey there!
You can post the code or send it to me and I'll sort out the warning you're getting. It's likely just from the DevblocksHttpIO object ($request->path).
You probably just need to initialize it to an empty object:
$request = new DevblocksHttpRequest(array());
nabeel
12-07-2007, 05:16 AM
Yeah, I think that was it. But since it didn't affect the script itself I didn't bother.
I'll send it once I'm back at work. Thanks alot! I appreciate the help. It's great when companies personally help out :)
jstanden
12-07-2007, 05:49 AM
You're definitely welcome! It's always fun to see how flexible the code is. :)
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.