ruby-on-railsrubycronrvmwhenever

syntax error near unexpected token `('


I am using whenever(whenever (0.8.2)) in my rails project('rails', '3.2.11'). Everything that is given in the readme of the whenever is present in my schedule.rb but when i try to use cron job during execution it don't complete but gives me some error in my error.log file:-

Error:-

 syntax error near unexpected token `('
`APP_PATH = File.expand_path('../../config/application',  __FILE__)'

If any one is having any idea about this please let me know i tried a lot but still got nothing

cron job is working for my other project on the same system but can't figure out what is the issue with this one.

My schedule.rb:-

set :output, {:error => 'error.log', :standard => 'cron.log'}

every :day, :at => '1:00 am' do
   runner "Site.daily_stats"
end

every 2.minutes do
  runner "Notifier.testing_whenever.deliver"
end

Solution

  • Hey finally I got the solution the problem was in rails file in script director. Make sure this file starts with this line :- #!/usr/bin/env ruby and in my file in the starting there was just a blank space and then this line was present.

    Remove that space and now everything is working fine :)