Forums / Developer / How do cron jobs know which site access settings to use
Eirik Alfstad Johansen
Thursday 22 January 2004 1:16:47 am
Hi,
I'm wondering how the eZP cron job scripts know which site access settings to use (first and foremost concerning which database to use). I've noticed the "-s,--siteaccess" availble when running runcronjobs.php, and I've used it successfully, but my custom made cron job doesn't seem to take the specific siteaccess into consideration. At least that's my theory since it's unable to connect to the database.
Should it put something specifc into the cronjob script in order to make it fetch the settings from the specified siteaccess?
BTW, here's the code
[code] <?php $db =& eZDB::instance(); echo mysql_error() . "\n\n"; ?>[/code]
And here's the result it generates when run from runcronjobs.
[result] Running extension/affiliate/cronjobs/createreports.php Can't connect to local MySQL server through socket '/var/tmp/mysql.sock' (2)[/result]
Thanks in advance !
Sincerely,
Eirik Johansen
Sincerely, Eirik Alfstad Johansen http://www.netmaking.no/
Wednesday 08 December 2004 6:28:16 am
Actually, I'm still struggling with this problem, nearly a year later. Does anyone know what I could be doing wrong?
Sunday 09 January 2005 5:15:57 am
Bump.
Wednesday 12 January 2005 11:45:13 am
I will keep naging until I get an answer! :)
No, but seriously, I would greatly appreciate some help on this issue as it's the only thing holding me back from launching a client site.
Eazy-pleaze?
Björn X
Wednesday 12 January 2005 2:12:04 pm
Usually there is no futher action required to choose the siteaccess from the code site. You just have to use the class eZScript like it has been done before with other crons scripts
the -s option is the way to go
you may also consider running your cron as a cronjobscript part over "php runcronjobs.php -ssiteaccesssname cronjobpart"
Wednesday 19 January 2005 11:44:38 am
Thanks for the tip.
However, I've narrowed it down to what seems to be a problem with my cli version of PHP (on _both_ my servers, actually) making it unable to connect to mysql for some reason. I have yet to figure out the reason, though, but at least I'm not scanning ezp code anymore. :)