如何增加cronjob/crontab的超时时间? [英] How do I increase timeout for a cronjob/crontab?

查看:124
本文介绍了如何增加cronjob/crontab的超时时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个脚本,该脚本从日期在指定时间段内的 solr 中获取数据,然后我将脚本作为日常cron运行.

I have written a script that gets data from solr for which date is within the specified period, and I run the script using as a daily cron.

问题是cronjob无法完成任务.如果我手动运行脚本(在同一时间段内),则效果很好.如果减少指定的时间段,则脚本也将从cron运行.因此,我的猜测是cronjob在运行脚本时超时,因为有很多数据要处理.

The problem is the cronjob does not complete the task. If I manually run the script (for the same time period), it works well. If I reduce the specified time period, the script runs from the cron as well. So my guess is cronjob is timing out while running the script is there is much data to process.

如何增加cronjob的超时时间?

How do I increase the timeout for cronjob?

PS-1.我在cronjob中运行的脚本是运行python脚本的bash脚本.

PS - 1. The script I am running in cronjob is a bash script which runs a python script.

推荐答案

您可以尝试使用 ulimit -t [秒数],然后运行脚本.

You could try to use ulimit -t [number of seconds] in the cronjob before running the script.

这篇关于如何增加cronjob/crontab的超时时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆