My other Q was closed as they said it was a duplicate of this question.
That answer didnt work though unfortunately.
Basically I'm trying to get Whenever to run my refresh_sitemaps automatically.
The interesting thing in my cron.log file it looks like this (note the weird characters):
/usr/bin/ruby: No such file or directory -- °¯Ø (LoadError)
/usr/bin/ruby: No such file or directory -- ؽô (LoadError)
/usr/bin/ruby: No such file or directory -- à=Ù (LoadError)
This is whats in my schedule.rb:
env :PATH, '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
set :output, "#{path}/log/cron.log"
every 1.day, :at => '3:00 pm' do
rake "-s sitemap:refresh"
end
When i run cap refresh_sitemaps
it works perfectly, it just doesnt work when it tries to run on its own as a Cron job.
i'm positive the path to ruby is correct from that PATH above. This is the result if I SSH in and run the following:
user@example.com [~]# /usr/local/bin/ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
the weird thing is it doesnt seem to even see my "path", as its still looking in /usr/bin/ruby.
The other weird thing is there is actually something there.... as per this ssh command:
user@example.com [~]# /usr/bin/ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
UPDATE
When I run crontab -l
this is what I get. Notice the extra paths I added, that was from a mediatemple help guide I found for this issue (although it didnt give any other descriptions about this):
# Begin Whenever generated tasks for: APPNAME
PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
GEM_HOME=/usr/local/lib/ruby/gems/1.9.1
GEM_PATH=/usr/local/lib/ruby/gems/1.9.1
RUBYLIB=/usr/local/lib/ruby/site_ruby/1.9.1
10 17 * * * /bin/bash -l -c 'cd /home/USER/u/apps/APPNAME/releases/20120731204722 && RAILS_ENV=production bundle exec rake -s sitemap:refresh --silent >> /home/USER/u/apps/APPNAME/releases/20120731204722/log/cron.log 2>&1'
# End Whenever generated tasks for: APPNAME
I have tried running this by itself after i SSH in and it runs fine:
/bin/bash -l -c 'cd /home/USER/u/apps/APPNAME/releases/20120731204722 && RAILS_ENV=production bundle exec rake -s sitemap:refresh --silent