【发布时间】:2013-11-18 20:36:26
【问题描述】:
我正在尝试使用 crontab 执行以下 shell 脚本:
#!/bin/sh
cd /mnt/voylla-production/current
bundle exec rake maintenance:last_2_days_orders
bundle exec rake maintenance:send_last_2_days_payment_dropouts
crontab 条目是
0 16 * * * /mnt/voylla-production/releases/20131031003111/voylla_scripts/cj_4pm.sh
我在邮件中收到以下错误消息:
/mnt/voylla-staging/current/voylla_scripts/cj_4pm.sh: line 3: bundle: command not found
/mnt/voylla-staging/current/voylla_scripts/cj_4pm.sh: line 4: bundle: command not found
当我手动运行命令时,我没有收到错误消息。不知道这里发生了什么。谁能指出来。
谢谢
【问题讨论】:
-
您使用的是 RVM 还是类似的东西? Cron 任务在与您的 shell 不同的环境中执行。红宝石和宝石的路径设置不正确。
-
所以谷歌搜索“RVM crontab”:)
-
@SergioTulentsev :感谢您的帮助,我应该可以从这里获取它。:)
-
我认为您应该使用捆绑包的完整路径。让我们尝试在 app 文件夹中运行“which bundle”,您将获得 bundle 命令的完整路径,然后在 crontab 中使用它。
标签: ruby-on-rails rake bundle crontab