lib/capistrano/tasks/crono.cap in capistrano-crono-0.1.2 vs lib/capistrano/tasks/crono.cap in capistrano-crono-0.2.0.pre

- old
+ new

@@ -6,38 +6,39 @@ pid_file_exists?(pid_file) and test(*("kill -0 $( cat #{pid_file} )").split(' ')) end namespace :load do task :defaults do - set :crono_pid, -> { File.join(shared_path, 'tmp', 'pids', 'crono.pid') } + set :pid_dir, -> { File.join(shared_path, 'tmp', 'pids') } set :crono_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) } set :crono_log, -> { File.join(shared_path, 'log', 'crono.log') } set :crono_role, -> { :app } end end namespace :crono do desc "Start crono" task :start do on roles fetch(:crono_role) do - pid_file = fetch(:crono_pid) args = [] - args.push "--daemonize" - args.push "--pidfile #{pid_file}" + args.push "--piddir #{pid_dir}" args.push "--logfile #{fetch(:crono_log)}" args.push "--environment #{fetch(:crono_env)}" within release_path do - execute(:bundle, :exec, :crono, args.compact.join(' ')) unless process_exists?(pid_file) + execute(:bundle, :exec, :crono, :start, args.compact.join(' ')) end end end desc "Stop crono" task :stop do on roles fetch(:crono_role) do - if test("[ -d #{release_path} ]") - pid_file = fetch(:crono_pid) - execute("kill -TERM `cat #{pid_file}`") if process_exists?(pid_file) + args = [] + args.push "--piddir #{pid_dir}" + args.push "--logfile #{fetch(:crono_log)}" + args.push "--environment #{fetch(:crono_env)}" + within release_path do + execute(:bundle, :exec, :crono, :stop, args.compact.join(' ')) end end end desc 'Restart crono'