S
S
serious9112015-03-30 10:22:18
PHP
serious911, 2015-03-30 10:22:18

PHP script not working on CRON?

Hello.
Can you please tell me why the script on CRON does not work? Server on OS Ubuntu+PHP5. Several PHP scripts are launched on the server via CRON. Some of the scripts work fine, and some don't. It is precisely those scripts that run for a long time - 30-50+ seconds that do not work correctly.
Crontab -l:
# works fine
0 9 * * * /usr/bin/php5 /var/www/public_html/site1.com/www/poster.php
# works incorrectly
0 7 * * 1 /usr/bin/php5 /var /www/public_html/sub.site2.com/www/grab/script1.php 20 7 * * 1 /usr/bin/ php5
/var/www/public_html/sub.site2.com/www/grab/script2.php
cron logs (grep CRON /var/log/syslog) scripts run like normal:
CMD (/usr/bin/php5 /var/www/public_html/site1.com/www/poster.php)
CMD (/usr/bin/php5 /var/www/public_html/sub.site2.com/www/grab/ script1.php)
CMD (/usr/bin/php5 /var/www/public_html/sub.site2.com/www/grab/script2.php)
When run manually through a browser, everything works fine.
Previously, there was another glitch when cron ran large scripts several times instead of one 0 7 * * 1 , but they were not completely executed.
For scripts that run for a long time, I increased the time limits, but it doesn't help.

ignore_user_abort(true);
ini_set('max_execution_time', 600);
set_time_limit(600);

Previously, these scripts worked on another hosting and everything seemed to be fine, but there I set cron tasks through the ISP Manager.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivankomolin, 2015-03-30
@serious911

Have you tried running these commands in the console as the user who owns the specified crontab?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question