whenever icon indicating copy to clipboard operation
whenever copied to clipboard

Cron job not running with when ever..

Open anilmagapu opened this issue 9 years ago • 6 comments

Hi there, I am using rails 3 application ,with that i would like to schedule task using whenever in every minute .but it is not working and no issues getting .plase help me.

Source : Added gem in gemfile: gem 'whenever', :require => false wheneverize .

schedule.rb

every 1.minute do
    command "echo 'one' && echo 'two'"
    runner "CollEmployTransactionHpEntry.some_method", :environment => "development"
end

crontab -l

* * * * * /bin/bash -l -c 'echo '\''one'\'' && echo '\''two'\'''

* * * * * /bin/bash -l -c 'cd /home/nyros/Documents/Projects/PPFC/Augest/8/Telecaller/PPFC && bundle exec script/rails runner -e development '\''CollEmployTransactionHpEntry.some_method'\'''

Thanks & Regards, Anil

anilmagapu avatar Aug 08 '16 06:08 anilmagapu

Please explain how you have Ruby installed and provide your Gemfile.lock. Also please confirm you have no other content in schedule.rb (I am suspicious that there is no output redirection in your crontab, which there should be).

benlangfeld avatar Aug 08 '16 12:08 benlangfeld

GIT
  remote: git://github.com/bernat/best_in_place.git
  revision: 57b525e487cd6ba10467b47d8bf8907c645f6917
  specs:
    best_in_place (3.1.0)
      actionpack (>= 3.2)
      railties (>= 3.2)

GIT
  remote: git://github.com/ifad/data-confirm-modal.git
  revision: a2018ab8893cdeeeffaae407368ed1a20ea72b30
  specs:
    data-confirm-modal (1.1.0)
      railties (>= 3.0)

GIT
  remote: git://github.com/rweng/jquery-datatables-rails.git
  revision: b8e6b6fa51e0074ea44b4771a68b1817a14023fc
  specs:
    jquery-datatables-rails (3.4.0)
      actionpack (>= 3.1)
      jquery-rails
      railties (>= 3.1)
      sass-rails

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (3.2.22)
      actionpack (= 3.2.22)
      mail (~> 2.5.4)
    actionpack (3.2.22)
      activemodel (= 3.2.22)
      activesupport (= 3.2.22)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    active_model_serializers (0.9.5)
      activemodel (>= 3.2)
    activemodel (3.2.22)
      activesupport (= 3.2.22)
      builder (~> 3.0.0)
    activerecord (3.2.22)
      activemodel (= 3.2.22)
      activesupport (= 3.2.22)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activerecord-sqlserver-adapter (3.2.13)
      activerecord (~> 3.2.0)
    activeresource (3.2.22)
      activemodel (= 3.2.22)
      activesupport (= 3.2.22)
    activesupport (3.2.22)
      i18n (~> 0.6, >= 0.6.4)
      multi_json (~> 1.0)
    angularjs-rails (1.5.5)
    arel (3.0.3)
    bootstrap-sass (3.1.1.0)
      sass (~> 3.2)
    builder (3.0.4)
    chronic (0.10.2)
    client_side_validations (3.2.8)
    client_side_validations-simple_form (2.1.0)
      client_side_validations (~> 3.2.5)
      simple_form (~> 2.1.0)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.8.0)
    daemons (1.2.3)
    erubis (2.7.0)
    eventmachine (1.2.0.1)
    execjs (2.6.0)
    font-awesome-rails (4.3.0.0)
      railties (>= 3.2, < 5.0)
    geocoder (1.3.4)
    gmaps4rails (2.1.2)
    hike (1.2.3)
    i18n (0.7.0)
    journey (1.0.4)
    jquery-rails (3.1.4)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    jquery-turbolinks (2.1.0)
      railties (>= 3.1.0)
      turbolinks
    json (1.8.3)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.25.1)
    mini_portile2 (2.0.0)
    multi_json (1.12.0)
    nokogiri (1.6.7.2)
      mini_portile2 (~> 2.0.0.rc2)
    pdfkit (0.8.2)
    polyglot (0.3.5)
    power_assert (0.3.0)
    pundit (1.1.0)
      activesupport (>= 3.0.0)
    rack (1.4.7)
    rack-cache (1.6.1)
      rack (>= 0.4)
    rack-ssl (1.3.4)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (3.2.22)
      actionmailer (= 3.2.22)
      actionpack (= 3.2.22)
      activerecord (= 3.2.22)
      activeresource (= 3.2.22)
      activesupport (= 3.2.22)
      bundler (~> 1.0)
      railties (= 3.2.22)
    railties (3.2.22)
      actionpack (= 3.2.22)
      activesupport (= 3.2.22)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (11.1.2)
    rdoc (3.12.2)
      json (~> 1.4)
    roo (2.4.0)
      nokogiri (~> 1)
      rubyzip (~> 1.1, < 2.0.0)
    rubyzip (1.2.0)
    sass (3.4.22)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    simple_calendar (2.1.5)
      rails (>= 3.0)
    simple_form (2.1.3)
      actionpack (~> 3.0)
      activemodel (~> 3.0)
    sprockets (2.2.3)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    test-unit (3.1.8)
      power_assert
    thin (1.6.4)
      daemons (~> 1.0, >= 1.0.9)
      eventmachine (~> 1.0, >= 1.0.4)
      rack (~> 1.0)
    thor (0.19.1)
    tilt (1.4.1)
    tiny_tds (1.0.3)
      mini_portile2 (~> 2.0)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (2.5.3)
      coffee-rails
    tzinfo (0.3.49)
    uglifier (3.0.0)
      execjs (>= 0.3.0, < 3)
    underscore-rails (1.8.3)
    whenever (0.9.7)
      chronic (>= 0.6.3)
    will_paginate (3.1.0)
    wkhtmltopdf-installer (0.12.3.3)

PLATFORMS
  ruby

DEPENDENCIES
  active_model_serializers
  activerecord-sqlserver-adapter
  angularjs-rails
  best_in_place!
  bootstrap-sass (= 3.1.1.0)
  client_side_validations
  client_side_validations-simple_form
  coffee-rails (~> 3.2.1)
  coffee-script-source (= 1.8.0)
  data-confirm-modal!
  font-awesome-rails (= 4.3.0.0)
  geocoder
  gmaps4rails
  jquery-datatables-rails!
  jquery-rails
  jquery-turbolinks
  pdfkit
  pundit
  rails (= 3.2.22)
  roo
  sass-rails (~> 3.2.3)
  simple_calendar (~> 2.0)
  simple_form (~> 2.0)
  test-unit (~> 3.0)
  thin
  tiny_tds
  turbolinks
  uglifier (>= 1.0.3)
  underscore-rails (~> 1.8, >= 1.8.3)
  whenever
  will_paginate
  wkhtmltopdf-installer (~> 0.12.3.3)

BUNDLED WITH
   1.12.4

Schedular.rb

every 1.minute do
    runner "CollEmployTransactionHpEntry.some_method", :environment => "development"
end

anilmagapu avatar Aug 10 '16 11:08 anilmagapu

Your initial reply included set :output, "/path/to/my/cron_log.log" which you then edited out. Please provide the entire contents of this file, do not edit it.

benlangfeld avatar Aug 10 '16 11:08 benlangfeld

/home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find multi_json-1.12.0 in any of the sources (Bundler::GemNotFound)
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/spec_set.rb:85:in `map!'
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/spec_set.rb:85:in `materialize'
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/definition.rb:132:in `specs'
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/definition.rb:177:in `specs_for'
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/definition.rb:166:in `requested_specs'
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/environment.rb:18:in `requested_specs'
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/runtime.rb:13:in `setup'
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler.rb:122:in `setup'
    from /home/nyros/.rvm/gems/ruby-2.2.1/gems/bundler-1.9.9/lib/bundler/setup.rb:18:in `<top (required)>'
    from /home/nyros/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/nyros/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'

anilmagapu avatar Aug 10 '16 11:08 anilmagapu

By "this file" I meant your schedule. There is something strange going on with the code you're reporting, and the suspicion that something is being left out remains. With what I've seen so far, I can't help you. If you can provide the entire contents without editing of the schedule and the crontab, then maybe I can.

benlangfeld avatar Aug 10 '16 12:08 benlangfeld

@anilmagapu are you still facing this issue? could you please post the contents of config/schedule.rb file as is.

prasadsurase avatar Sep 06 '16 10:09 prasadsurase