新手问题 whenever 怎么不执行

fayake · 2013年12月17日 · 最后由 fayake 回复于 2013年12月18日 · 3875 次阅读

```ruby config/schedule.rb set :output, "/home/dave/demo/log/cron_log.log" set :path, "/home/dave/demo" set :environment, 'production'

every 3.minutes do runner "DZGJ.aa" end

0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /bin/bash -l -c 'cd /home/dave/demo && script/rails runner -e production '\''ORDERS.aa'\'' >> /home/dave/demo/log/cron_log.log 2>&1'

$ git --version
git version 1.7.10.GIT

```ruby
/home/dave/.rvm/gems/ruby-1.9.3-p194/bundler/gems/tire-068e0ef806d1/tire.gemspec:16:in ``': No such file or directory - git ls-files (Errno::ENOENT)
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/bundler/gems/tire-068e0ef806d1/tire.gemspec:16:in `block in <main>'
    from /home/dave/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1368:in `initialize'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/bundler/gems/tire-068e0ef806d1/tire.gemspec:5:in `new'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/bundler/gems/tire-068e0ef806d1/tire.gemspec:5:in `<main>'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler.rb:280:in `eval'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler.rb:280:in `rescue in block in load_gemspec'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler.rb:275:in `block in load_gemspec'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler.rb:273:in `chdir'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler.rb:273:in `load_gemspec'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/source.rb:340:in `block in load_spec_files'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/source.rb:339:in `each'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/source.rb:339:in `load_spec_files'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/source.rb:572:in `load_spec_files'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/source.rb:372:in `local_specs'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/source.rb:557:in `specs'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/lazy_specification.rb:53:in `__materialize__'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/spec_set.rb:86:in `block in materialize'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `map!'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `materialize'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/definition.rb:172:in `specs_for'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/definition.rb:161:in `requested_specs'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/environment.rb:23:in `requested_specs'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/runtime.rb:11:in `setup'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler.rb:107:in `setup'
    from /home/dave/.rvm/gems/ruby-1.9.3-p194/gems/bundler-1.1.3/lib/bundler/setup.rb:17:in `<top (required)>'
    from /home/dave/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/dave/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

查看一下 cron_log 还有有个 errorlog 的设置的

之前写过一个好像要手动更新 cron 以后才会执行

要手动写入 whenever -w whenever -i

有没有权限操作 crontable?

你确定有没有写入 Cron crontab -e

然后看 Cron 下的环境变量是否正确。

有没有写入 crontab 啊?你执行crontab -e查看是否写入成功

#1 楼 @ShiningRay crontab 中是这样 script/rails runner -e production '\''ORDERS.aa'\' 我不知道为会多了'\'

#4 楼 @galaxy_watcher 我可以直接 crontab -e

#1 楼 @ShiningRay

/home/dave/.rvm/gems/ruby-1.9.3-p194/bundler/gems/tire-068e0ef806d1/tire.gemspec:16:in ``': No such file or directory - git ls-files (Errno::ENOENT)

#3 楼 @TsingHan crontab 中是这样 script/rails runner -e production '\''ORDERS.aa'\' 我不知道为会多了'\'

#9 楼 @fayake 难道是没装 git 么?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号