Reputation: 12644
I have a cron job that executes a codeigniter script. Underneath, somewhere, something is writing to the log file. If this is the first attempt of the day, the cron job user creates the file, instead of apache, the usual owner. This then causes a bunch of errors to show in the log file, like so:
ERROR - 2011-12-08 22:45:09 --> Severity: Warning --> chmod(): µö²Ä¤µ¤ì¤Æ¤¤¤Ê¤¤Áàºî¤Ç¤¹ /xxx/xxx/xxx/system/libraries/Log.php 109
If I manually change to the owner to apache, they go away.
It's impractable to turn off logging, and I could go and edit the underlying codeigniter code, I don't think that is a good solution.
What's the best way to get codeigniter cron jobs to work with log file properly?
Upvotes: 0
Views: 555
Reputation: 41
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"url where your controller");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($ch);
curl_close ($ch);
?> set your cron job give location where this file location
Upvotes: 0
Reputation: 1295
Run the cron job as apache, instead of whatever other random user it's currently running as.
Upvotes: 1