gpt4 book ai didi

ruby-on-rails - 每当 ruby 在 rails 上

转载 作者:行者123 更新时间:2023-12-04 18:38:26 26 4
gpt4 key购买 nike

在我的日程安排中:

every 10.minutes do
runner "Model.method"
end

每当在我的 crontabs 中创建这个
0,10,20,30,40,50 * * * * /bin/bash -l -c 'cd /home/projects/Monitoring && script/rails runner -e development '\''Model.method'\'''

我试图在我的控制台中运行该命令并且它有效。为什么它不能自动工作,我要疯了!

在我的系统日志中
Mar 11 11:38:01 UbuntuRails CRON[20050]: (ruben) CMD (/bin/bash -l -c 'cd /home/projects/Monitoring && script/rails runner -e development '\''Ping.check_pings'\''')
Mar 11 11:38:01 UbuntuRails CRON[20048]: (CRON) info (No MTA installed, discarding output)
Mar 11 11:38:01 UbuntuRails CRON[20047]: (CRON) error (grandchild #20050 failed with exit status 1)
Mar 11 11:38:01 UbuntuRails CRON[20047]: (CRON) info (No MTA installed, discarding output)

最佳答案

我在 Ubuntu 10.10 上遇到了同样的问题。
原来 -l 选项不会按预期加载环境,但 -i 会。 (见 this issue)

正如问题线程所述,修复方法是编辑您的 schedule.rb 并添加:

set :job_template, "/bin/bash -i -c ':job'"

干杯

关于ruby-on-rails - 每当 ruby 在 rails 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5271822/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com