-
-
Save fred/11174610 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| after "deploy:stop", "clockwork:stop" | |
| after "deploy:start", "clockwork:start" | |
| after "deploy:restart", "clockwork:restart" | |
| set :cw_log_file, "#{shared_path}/log/clockwork.log" | |
| set :cw_pid_file, "#{shared_path}/tmp/pids/clockwork.pid" | |
| namespace :clockwork do | |
| desc "Stop clockwork" | |
| task :stop, :roles => :app, :on_no_matching_servers => :continue do | |
| run "daemon --inherit --name=clockwork --env='#{rails_env}' --output=#{cw_log_file} --pidfile=#{cw_pid_file} -D #{current_path} --stop || true" | |
| end | |
| desc "Clockwork status" | |
| task :status, :roles => :app, :on_no_matching_servers => :continue do | |
| run "daemon --inherit --name=clockwork --env='#{rails_env}' --output=#{cw_log_file} --pidfile=#{cw_pid_file} -D #{current_path} --verbose --running || true" | |
| end | |
| desc "Start clockwork" | |
| task :start, :roles => :app, :on_no_matching_servers => :continue do | |
| run "daemon --inherit --name=clockwork --env='#{rails_env}' --output=#{cw_log_file} --pidfile=#{cw_pid_file} -D #{current_path} -- bundle exec clockwork lib/clockwork.rb" | |
| end | |
| desc "Restart clockwork" | |
| task :restart, :roles => :app, :on_no_matching_servers => :continue do | |
| stop | |
| start | |
| end | |
| def rails_env | |
| fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : '' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment