Good morning, I have into my ubunut server a script that check into a database some value and if the condition is true send some email. If I launch into the browser the script like:
http://www.my_site.com/reports/generate.php
This works, mail is arrived.
If into my crontab I write this line into the file /etc/crontab:
0 12 * * * root php /var/www/reports/generate.php
This doesn't work, mail isn't arrived and the value are the same. I have check the path and is correct, I give 777 permission to this file, but doesn't work in cron.
Can someone explain me why in cron deosn't work?
This script take about 5 minutes to end.
This is the syslog.log rfer to the script
Jun 17 12:00:03 site /USR/SBIN/CRON[5352]: (root) CMD ( php /var/www/reports/generate.php)
Jun 17 12:00:07 site postfix/pickup[2834]: 10546128001: uid=0 from=<root>
Jun 17 12:00:07 site postfix/cleanup[5381]: 10546128001: message-id=<20130617100007.10546128001@site.localdomain>
Jun 17 12:00:07 site postfix/qmgr[3259]: 10546128001: from=<root@site.localdomain>, size=941, nrcpt=1 (queue active)
Jun 17 12:00:08 site postfix/local[5384]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Jun 17 12:00:08 site postfix/local[5384]: 10546128001: to=<vpsimple@site.localdomain>, orig_to=<root>, relay=local, delay=2, $
Jun 17 12:00:08 site postfix/cleanup[5381]: 438CD128002: message-id=<20130617100008.438CD128002@site.localdomain>
Jun 17 12:00:08 site postfix/qmgr[3259]: 438CD128002: from=<>, size=2759, nrcpt=1 (queue active)
Jun 17 12:00:08 site postfix/bounce[5386]: 10546128001: sender non-delivery notification: 438CD128002
Jun 17 12:00:08 site postfix/qmgr[3259]: 10546128001: removed
Jun 17 12:00:08 site postfix/local[5384]: 438CD128002: to=<xxx@site.localdomain>, orig_to=<root@site.localdomain>, re$
Jun 17 12:00:08 site postfix/qmgr[3259]: 438CD128002: removed
Jun 17 12:03:24 site kernel: Shorewall:net2fw:DROP:IN=eth0 OUT= MAC=00:16:3e:70:a5:ad:00:30:48:56:76:d3:08:00 SRC=122.228.129.25$
Jun 17 12:09:03 site /USR/SBIN/CRON[6104]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/l$
Jun 17 12:13:13 site kernel: Shorewall:net2fw:DROP:IN=eth0 OUT= MAC=00:16:3e:70:a5:ad:00:30:48:56:76:d3:08:00 SRC=61.188.37.237 $
Jun 17 12:15:32 site postfix/pickup[2834]: 2B3B1128001: uid=33 from=<www-data>
-------------------------EDIT---------------------
I have change the file crontab in this mode:
0 13 * * * root php /usr/bin/php -f /var/www/reports/generate.php 1>/dev/null 2>&1
and not works, this is the new syslog.log
Jun 17 13:00:03 site /USR/SBIN/CRON[9886]: (root) CMD ( php /usr/bin/php -f /var/www/reports/generate.php $
Jun 17 13:01:19 site kernel: Shorewall:net2fw:DROP:IN=eth0 OUT= MAC=00:16:3e:70:a5:ad:00:30:48:56:76:d3:08:00 SRC=122.141.177.11$
Jun 17 13:09:02 site /USR/SBIN/CRON[10624]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/$
Jun 17 13:17:02 site /USR/SBIN/CRON[11246]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly 1>/dev/null 2>&1)