Forums / Developer / runcronjobs with args for script

runcronjobs with args for script

Author Message

Vincent DELHAYE

Tuesday 24 October 2006 7:58:44 am

Hello,
I need to execute some script by cronjobs with option.
Example :
/usr/local/php/bin/php -C /var/www/atousantevd/runcronjobs.php alerte for_day
/usr/local/php/bin/php -C /var/www/atousantevd/runcronjobs.php alerte for_month

But I don't see how to get my option 'for_day' in my script 'alerte.php'.

Somebody has already done it ?

thx

Kristof Coomans

Tuesday 24 October 2006 9:15:54 am

Hello Vincent

As far as I know you can not specify any custom options for cron scripts. Use a normal CLI script instead, by using the eZCLI and eZScript classes. runcronjobs.php is in fact such a CLI script. There are some other good examples in the bin/php directory.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Piotr Switkowski

Wednesday 25 October 2006 5:42:24 am

Hello

I need to do the same thing. I am thinking about the following logic:
- create script that have all logic depending on your parameter var
- create script that sets the value of your parameter to "for_day" and then includes script with login
- create script as in previous point, but setting parameter to 'for_month'

Instead of passing the parameter you wpuld simply need to call right script, but all logic will be written only once.