How do I trigger cron-job early - or run script in background?


#1

Hello,

I have a con-job that runs once per day. I’m trying to figure out how to trigger the cron-job early when someone visits a particular page?

My script address is located at: http://www.mysite.com/cron/script.php

My scripts also redirects a few times to prevent timeouts. For example, after 50,000 items to check, it redirects to process the next 50,000:
[php]header(Location: script.php?start=50000);[/php]

So need something to trigger the “server” to act like a person in the background and simply run through the script, redirects and all. I don’t want the “client user” waiting 1-2 minutes while the whole time the script is running.

I’ve tried cURL, exec() and shell_exec() and none seem to work like the cron-jobs set up manually on Dreamhost’s control panel. I really don’t know how to use exec() or shell_exec(), particularly with the commands and the URL path of the script, so I was hoping someone could help.

Thanks