CodeIgniter Forums
how can i check cron tab log - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: how can i check cron tab log (/showthread.php?tid=51620)



how can i check cron tab log - El Forum - 05-10-2012

[eluser]Angel Lay[/eluser]
Hello

I want to create cronjob that i never try before.

I created cron.php. The content is below:
Code:
<?php
$url = 'http://test.com/controller/method';
file_get_contents($url);
?>

reference : http://ellislab.com/forums/viewthread/201824/#995592

The things i have done in crontab
/usr/bin/php -q /var/.../myroot/cron.php

But, it seems not working.Is there anything wrong?
how can i check log or something else that show the error?
I use Plesk Control Panel.

Thanks.


how can i check cron tab log - El Forum - 05-11-2012

[eluser]vrencianz[/eluser]
Maybe this helps: http://ellislab.com/forums/viewthread/215821/

Also you can use

Code:
/usr/bin/php -q /var/.../myroot/cron.php 2>&1 >> /var/log/your_log.log

To redirect all output (errors and echoes) to the /var/log/your_log.log file




how can i check cron tab log - El Forum - 05-14-2012

[eluser]Angel Lay[/eluser]
Unfortunately It still can't work.


how can i check cron tab log - El Forum - 05-14-2012

[eluser]weboap[/eluser]
what i have done before and worked for me is :

created the the controller thats supposed to do some job

i take your example : http://test.com/controller/method


then in the cron job you will have to reference it by its real path

eg : /home/~username/public_html/application/controllers/controller/method


that will give :
Code:
php -q /home/~username/public_html/application/controllers/controller/method 2>&1 >> /var/log/your_log.log


and it's important that the cron job run as the user owner of the file.
hope it help.





how can i check cron tab log - El Forum - 05-17-2012

[eluser]Angel Lay[/eluser]
mystructure is
eg : /home/~username/public_html/mysubfolder/mysubfolder2/mycodeigniter/system/application/controllers/controller/method


I tried as below:

Code:
php -q /home/myroot/~username/mysubfolder/cron.php 2>&1 >> /var/log/my_log.log
or
php -q /home/~username/myroot/mysubfolder/cron.php 2>&1 >> /var/log/my_log.log

Code:
php -q /home/~username/myroot/mysubfolder/mysubfolder2/mycodeigniter/system/application/controllers/mycontroller/mymethod 2>&1 >> /var/log/my_log.log

whatever, i haven't got log file and cronjob can't work.


how can i check cron tab log - El Forum - 05-17-2012

[eluser]weboap[/eluser]
http://ellislab.com/codeigniter/user-guide/general/cli.html


http://codeigniter.com/wiki/Category:Advanced::CronScript