当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Why crontab can't executed on time

问题描述:

Hi is anybody know why the crontab could not execute on time? It delayed at least 10 seconds. It is aws EC2 Instance.

shell>uname -a

shell>Linux srv-796-db1 3.14.20-20.44.amzn1.x86_64 #1 SMP Mon Oct 6 22:52:46 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux #Server Info

awk '{split($3,a,":"); if (a[3] > 10) {print;}}' /var/log/cron | head -50

Jan 11 22:30:13 srv-796-db1 CROND[12017]: (root) CMD (sleep 20; /usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12019]: (root) CMD (sleep 10; /usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12021]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12024]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12026]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12030]: (root) CMD (sleep 40; /usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12032]: (root) CMD (sleep 30; /usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12034]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12037]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12041]: (root) CMD (sleep 20; /usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:13 srv-796-db1 CROND[12045]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:14 srv-796-db1 CROND[12048]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:30:14 srv-796-db1 CROND[12052]: (root) CMD (/usr/lib64/sa/sa1 1 1)

Jan 11 22:40:11 srv-796-db1 CROND[18845]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:40:11 srv-796-db1 CROND[18848]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:40:11 srv-796-db1 CROND[18849]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:40:11 srv-796-db1 CROND[18854]: (root) CMD (/usr/lib64/sa/sa1 1 1)

Jan 11 22:40:11 srv-796-db1 CROND[18855]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Jan 11 22:40:11 srv-796-db1 CROND[18858]: (root) CMD (/usr/bin/php -f #different php script here >/dev/null 2>&1)

Any idea???

网友答案:

Just Want to close this question.. Cronjob is not guarantee it tasks will run exactly on time. However, before starting a task, it will check last task status. If last task was not finish, it will delay the process.. On the other hands, many factors...such as "open files limit", "os time" ...

分享给朋友:
您可能感兴趣的文章:
随机阅读: