Is the user you logged in as to show the $PATH the same as the user
you are logging in with cap (bruparel)?
What if you set the full path to the whenever binary e.g. /usr/local/
bin/whenever in your deploy.rb?
I use the following which seems to work...
after "deploy:symlink", "deploy:update_crontab"
...
desc "Update the crontab file specified in config/schedule.rb"
task :update_crontab, :roles => :db, :only => { :primary => true }
do
rails_env = fetch(:rails_env, "staging")
send(run_method, "cd #{current_path} && whenever -f #{'config/
schedules/' + rails_env + '.rb'} --update-crontab #{current_path}/
config/schedule.rb")
end
Glenn
On Jun 6, 7:50 pm, Bharat <[email protected]> wrote:
> I am trying to automate the deployment to my production server. The
> application is hosted on Apache 2.2/Passenger/Enterprise Ruby
> environment. I am also using Thinking Sphinx and am trying to
> automate Reindexing operation using Whenever gem that basically writes
> the crontab file. The deployment fails because whenever command in my
> capistrano file cannot be found on production server. Here is the
> deploy.rb file:
>
> set :rails_root, "#{File.dirname(__FILE__)}/.."
> require "#{rails_root}/vendor/plugins/thinking-sphinx/lib/
> thinking_sphinx/deploy/capistrano"
>
> set :application, "ssfilemgr"
> set :repository, "[email protected]:harishk/ssfilemgr.git"
> #set :repository, "#{us...@#{domain}:git/#{application}.git"
>
> set :user, "bruparel"
> set :runner, "bruparel"
> set :admin_runner, runner
> #default_run_options[:pty] = true
>
> set :domain, '72.14.181.189'
> role :app, domain
> role :web, domain
> role :db, domain, :primary => true
>
> set :deploy_to, "/home/#{user}/r_work/#{application}"
>
> set :deploy_via, :remote_cache
> set :scm, "git"
> set :branch, "master"
> set :scm_verbose, true
> set :use_sudo, false
>
> namespace :deploy do
>
> desc "Restart Application"
> task :restart do
> run "touch #{current_path}/tmp/restart.txt"
> end
>
> desc "Cleanup older revisions"
> task :after_deploy do
> cleanup
> end
>
> desc "Update the crontab file"
> task :update_crontab, :roles => :db do
> run "cd #{release_path} && whenever --update-crontab #
> {application}"
> end
>
> end
>
> after "deploy:setup", "thinking_sphinx:shared_sphinx_folder"
> after "deploy:symlink", "deploy:update_crontab"
> after "deploy:restart", "thinking_sphinx:rebuild"
>
> Here is snippet of the terminal session when I run cap deploy with the
> fail message:
>
> * executing "find /home/bruparel/r_work/ssfilemgr/releases/
> 20090607024242/public/images /home/bruparel/r_work/ssfilemgr/releases/
> 20090607024242/public/stylesheets /home/bruparel/r_work/ssfilemgr/
> releases/20090607024242/public/javascripts -exec touch -t
> 200906070242.42 {} ';'; true"
> servers: ["72.14.181.189"]
> [72.14.181.189] executing command
> command finished
> * executing `deploy:symlink'
> * executing "rm -f /home/bruparel/r_work/ssfilemgr/current && ln -s /
> home/bruparel/r_work/ssfilemgr/releases/20090607024242 /home/bruparel/
> r_work/ssfilemgr/current"
> servers: ["72.14.181.189"]
> [72.14.181.189] executing command
> command finished
> triggering after callbacks for `deploy:symlink'
> * executing `deploy:update_crontab'
> * executing "cd /home/bruparel/r_work/ssfilemgr/releases/
> 20090607024242 && whenever --update-crontab ssfilemgr"
> servers: ["72.14.181.189"]
> [72.14.181.189] executing command
> *** [err :: 72.14.181.189] sh: whenever: not found
> command finished
> *** [deploy:symlink] rolling back
>
> Funny thing is when I ssh into the server and execute "whenever"
> command from "current" directory it works as shown below:
>
> ssrxgrp ~/r_work/ssfilemgr/current: whenever --update-crontab
> ssfilemgr
> [write] crontab file updated
>
> Moreover, the whenever binary is in the path too as shown below:
>
> ssrxgrp ~/r_work/ssfilemgr/current: which whenever
> /opt/ruby-enterprise/bin/whenever
> ssrxgrp ~/r_work/ssfilemgr/current:
>
> and here is the $PATH environment variable:
>
> ssrxgrp ~/r_work/ssfilemgr/current: echo $PATH
> /opt/ruby-enterprise/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/
> bin:/sbin:/bin:/usr/games
>
> Why is Capistrano having trouble finding the executable then?
>
> Thanks in advance for your help.
>
> Regards,
>
> Bharat
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Capistrano" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.co.uk/group/capistrano?hl=en
-~----------~----~----~----~------~----~------~--~---