【问题标题】:Ruby Bundle not running via cronjobRuby Bundle 未通过 cronjob 运行
【发布时间】:2015-04-25 07:55:44
【问题描述】:

我正在尝试从 cronjob 运行 ruby​​ 包,但它不工作,但如果我从 bash 命令行运行包,它工作正常。我错过了什么吗?

命令是: BUNDLE_GEMFILE=/client/Gemfile bundle exec /client/bin/runner

我在 crontab 中设置如下: */1 * * * * BUNDLE_GEMFILE=/client/Gemfile bundle exec /client/bin/runner

但我没有得到任何结果。非常感谢大家的帮助!

谢谢, 贾斯汀

【问题讨论】:

  • 在哪个用户下运行 cron 作业?它与控制台中的相同吗? 没有结果,甚至没有错误是什么意思?
  • 是的,@spickermann crontab 是 root 并且 bundle exec 也属于 root。

标签: ruby bash bundle crontab


【解决方案1】:

我不知道正在使用 rbenv,所以解决方法是:

*/1 * * * * bash -lc 'BUNDLE_GEMFILE=/client/Gemfile bundle exec /client/bin/runner'

【讨论】:

    猜你喜欢
    • 2021-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-18
    • 2016-09-07
    相关资源
    最近更新 更多