您的位置:首页 > 其它

OS_操作系统的CRONTAB 无法定时自动执行

2016-01-04 21:25 309 查看
前两日,客户要求我进行数据同步,我写好了脚本,设置了定时执行,让其在晚上后台自动执行,谁知第二天竟然没有执行。不得已又手动开始执行,

该问题已经遇到过多次,为了彻底解决该问题,今日对该现象进行了分析。

1.查看cron执行日志

查询 /var/adm/cron/log 报错如下:

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

! cron: 0481-087 The c queue maximum run limit has been reached.

 Mon Jan  4 14:35:00 BEIST 2016

! 0481-095 The cron job is being rescheduled.

 Mon Jan  4 14:35:00 BEIST 2016

问题原因:

crontab 没有定时执行是因为“! cron: 0481-087 The c queue maximum run limit has been reached.”。

修改/var/adm/cron/queuedefs 文件。在里面加上这样一句:"c.200j20n60w",然后kill PID,其中PID为cron进程号,新的cron设置就会生效。

Maximum number of jobs in the queue by default was 50. The errorc messages 0481-087, 0481-095 usually appears when this max. number

is reached. So you can increase the maximum number of jobs in /var/adm/cron/queuedefs , vi the queuedefs file and change

the b to c and the 50 to 200. by including this entry"c.200j20n60w" in the file. After making the changes to the file, 

killcron and it will respawn again with the new settings.

解决方法:

#

#

# here is an example of a low prority (nice 20), 50 entry batch queue

# b.50j20n60w

  c.600j10n120w

在/var/adm/cron/queuedefs/queuedefs加以C队列为1000就可以了。

ps -ef|grep cron

kill -9 con服务的进程号

cron的服务会自动重启,问题解决。

清理cron log文件(400M).
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: