linux - Cron from php script not work -


i've added cron job /etc/crontab file in php script method file_put_contents cron not execute. if save file in nano editor cron work. can promtp why cron added php script not executed? tried reloaded cron daemon didn't help. use class cron article http://www.kavoir.com/2011/10/php-crontab-class-to-add-and-remove-cron-jobs.html.

i changed method savejobs save crons file /etc/crontab.

static public function savejobs($jobs = array()) {     $output = file_put_contents('/etc/crontab', self::arraytostring($jobs));     return $output; } 

command add cron

crontab::addjob("*/1 * * * * root php -f /var/www/get_all_clients_data_db.php "); 

record cron added crontab cron not execute.

/etc/crontab

# /etc/crontab: system-wide crontab # unlike other crontab don't have run `crontab' # command install new version when edit file # , files in /etc/cron.d. these files have username fields, # none of other crontabs do.  shell=/bin/sh path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin  # m h dom mon dow user  command 17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly 25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) # */1 * * * * root php -f /var/www/get_all_clients_data_db.php 

i apologize mistakes. it's first question on stackoverflow. in advance.

share code, missing linking shared library error. enable crontab logging , check exact error coming.

there command line option logging. output saved screenlog.n file, n number of screen. man pages of screen:

‘-l’ tell screen turn on automatic output logging.

start program screen , check log why not running.

/usr/bin/screen -d -m -s -l crmservice /home/crmservice 

let me know if stuck further!


Comments