I am using craken to run cron processes on my aws machine instance. I have defined the following custom tasks in Capistrano:
namespace :craken do
desc "Install raketab"
task :install, :roles => :cron do
set :rails_env, "production" unless exists?(:rails_env)
set :env_args, (exists?(:env_args) ? env_args : "app_name=#{application} deploy_path=#{current_path}")
run "cd #{current_path} && rake #{env_args} RAILS_ENV=#{rails_env} craken:install"
end
task :uninstall, :roles => :cron do
set :rails_env, "production" unless exists?(:rails_env)
set :env_args, (exists?(:env_args) ? env_args : "app_name=#{application} deploy_path=#{current_path}")
run "cd #{current_path} && rake #{env_args} RAILS_ENV=#{rails_env} craken:uninstall"
end
end
before "deploy:symlink", "craken:uninstall"
after "deploy:symlink", "craken:install"
The problem is that the before "deploy:symlink", "craken:uninstall" causes deploy:cold to fail on first run, since the craken raketab has not yet been installed. How can I configure this to run only if it's a deploy and not a deploy:cold? Is there an environment variable that I can check?
Thanks!