Cron jobs, PHP and parameters
Posted by: dsexton
Posted on: 2006-05-29 08:35:00
I'm having a little bit of trouble getting cron jobs to work the way I want them - at the minute, I've got a cron job set up to run a script every day at midnight to backup a set of scripts that I'm working on, and it's working okay. However, there's a thing I was wondering about..on another system I set up a cron job on, I used a parameter on the command to make sure that people couldn't run the script via a browser (if($argv[0] == "myParam")), but I haven't been able to do so here.
My crontab, as it stands, looks like this:
"0 0 * * * /dh/cgi-system/php.cgi /home/user/domain/backup.php"
I tried just adding another parameter after the path to the script, but that didn't work very well..at all. The crontab was malformed when I did that, apparently, so I guessed I was on the wrong track.
Does anyone know how I can send a parameter to PHP using this method? Would I have to use the alternative method of running PHP scripts from cron as detailed on the wiki?
Thanks.