Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to only duplicate unicorn master, while retaining old master #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/mina/unicorn/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 11 additions & 11 deletions lib/mina/unicorn/utility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion lib/mina/unicorn/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Mina
module Unicorn
VERSION = "2.0.0"
VERSION = "2.1.1"
end
end