diff --git a/lib/mina/unicorn/tasks.rb b/lib/mina/unicorn/tasks.rb index eb86f1d..524ad03 100644 --- a/lib/mina/unicorn/tasks.rb +++ b/lib/mina/unicorn/tasks.rb @@ -31,4 +31,9 @@ task restart: :remote_environment do command restart_unicorn end + + desc "Duplicate unicorn service (this does not kill the old master)" + task duplicate: :remote_environment do + command duplicate_unicorn + end end diff --git a/lib/mina/unicorn/utility.rb b/lib/mina/unicorn/utility.rb index 21fe362..c9a5f23 100644 --- a/lib/mina/unicorn/utility.rb +++ b/lib/mina/unicorn/utility.rb @@ -46,6 +46,17 @@ def restart_unicorn def unicorn_send_signal(signal, pid=get_unicorn_pid) "#{unicorn_user} kill -s #{signal} #{pid}" end + + def duplicate_unicorn + %{ + if #{unicorn_is_running?}; then + echo "-----> Duplicating Unicorn..."; + #{unicorn_send_signal("USR2")}; + else + #{start_unicorn} + fi + } + end private @@ -61,17 +72,6 @@ def remote_process_exists?(pid_file) "[ -e #{pid_file} ] && #{unicorn_user} kill -0 `cat #{pid_file}` > /dev/null 2>&1" end - def duplicate_unicorn - %{ - if #{unicorn_is_running?}; then - echo "-----> Duplicating Unicorn..."; - #{unicorn_send_signal("USR2")}; - else - #{start_unicorn} - fi - } - end - # Command to check if Unicorn is running # def unicorn_is_running? diff --git a/lib/mina/unicorn/version.rb b/lib/mina/unicorn/version.rb index f343cde..da22163 100644 --- a/lib/mina/unicorn/version.rb +++ b/lib/mina/unicorn/version.rb @@ -1,5 +1,5 @@ module Mina module Unicorn - VERSION = "2.0.0" + VERSION = "2.1.1" end end