【发布时间】:2014-07-10 23:00:00
【问题描述】:
我尝试使用由 CRON 作业触发的 bash 脚本备份我的 gitlab 项目(它基于 ROR)。
bash 脚本没有问题,但 rake 迁移返回错误:
gitlabBackUp.sh: 12: /home/backup/scripts/gitlabBackUp.sh:捆绑:未找到
这是我在 gitlabBackUp.sh 中的做法
# Export the data
bundle exec rake gitlab:backup:create --trace RAILS_ENV=production
我尝试不使用bundle exec,但它返回了
/home/backup/scripts/gitlabBackUp.sh: 14: /home/backup/scripts/gitlabBackUp.sh: rake: 未找到
有什么建议吗?
编辑:
我终于让 cron 任务开始工作了:
/usr/local/bin/bundle exec /usr/local/bin/rake gitlab:backup:create --trace RAILS_ENV=production
【问题讨论】:
-
你是在使用 gitlab 综合还是“手”安装 gitlab?如果您使用omnibus,请不要使用
bundle exec rake gitlab:backup但gitlab-rake gitlab:backup -
当我手动启动脚本时,命令
bundle exec rake gitlab:backup有效,但我不使用 CRON -
好的,然后检查启动
CRON的用户的PATHenv var:在我的情况下,在旧的手动 gitlab 安装上,当调用sudo bundle exec rake ...时它正在工作,但是当我作为 root 时叫bundle exec rake...它说rake: not found。问题是我的root用户在他的PATH中没有 ruby、bundle、gem 和 co
标签: ruby-on-rails bash cron gitlab