简体   繁体   English

在cron作业中运行脚本

[英]Running a script within cron job

we have a hourly.sh script that contains abc.py script. 我们有一个hourly.sh脚本,其中包含abc.py脚本。 1. when i run the abc.py script independently it runs fine. 1.当我独立运行abc.py脚本时,它运行良好。 2. when i run an empty hoursly.sh (without abc.py script inside) it runs fine too. 2.当我运行一个空的hourlyly.sh(里面没有abc.py脚本)时,它也可以正常运行。

But when hourly.sh is ran with abc.py inside, it hits memory related issues ("16214 Segmentation fault (core dumped)"). 但是,当在带有abc.py的内部运行hourly.sh时,它将遇到与内存相关的问题(“ 16214分段错误(核心已转储)”)。 Just to provide an additional data point, there is no other script running at the same time as this script which can put more burden on the system. 仅提供一个额外的数据点,没有其他脚本与此脚本同时运行,这会给系统带来更多负担。

What could cause a script to fail when triggered via cron? 通过cron触发脚本会导致脚本失败吗?

There's always the possiblity that the differences in runtime environment cause problems. 总有可能运行时环境的差异会导致问题。 Take a look at the process parameters (Number of files etc.) which you can select using the "ulimit" command. 查看可以使用“ ulimit”命令选择的过程参数(文件数等)。

Maybe take a look at quotas for the user the cronjob is run, maybe the PATH environment. 也许看看运行cronjob的用户的配额,也许是PATH环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM