Skip to content
This repository was archived by the owner on Sep 25, 2019. It is now read-only.
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
22 changes: 13 additions & 9 deletions mssh/bin/mcmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ require 'pp'
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
require 'mcmd'

require 'rubygems'
require 'rangeclient'
require 'optparse'
options = {
:maxflight => 200,
Expand All @@ -14,28 +16,28 @@ options = {

optparse = OptionParser.new do |opts|
opts.on('-r', '--range RANGE', 'currently takes a CSV list') do |arg|
options[:range] = arg
options[:range] = arg
end
opts.on('-m', '--maxflight 50', 'How many subprocesses? 50 by default') do |arg|
options[:maxflight] = arg
options[:maxflight] = arg
end
opts.on('-t', '--timeout 60', 'How many seconds may each individual process take? 0 for no timeout') do |arg|
options[:timeout] = arg
options[:timeout] = arg
end
opts.on('-g', '--global_timeout 600', 'How many seconds for the whole shebang 0 for no timeout') do |arg|
options[:global_timeout] = arg
options[:global_timeout] = arg
end
opts.on('--noshell', "Don't invoke a shell. Args will be passed to exec verbatim ") do |arg|
options[:noshell] = arg
options[:noshell] = arg
end
opts.on('-c', '--collapse', "Collapse similar output ") do |arg|
options[:collapse] = arg
options[:collapse] = arg
end
opts.on('-v', '--verbose', "Verbose output") do |arg|
options[:verbose] = arg
options[:verbose] = arg
end
opts.on('-d', '--debug', "Debug output") do |arg|
options[:debug] = arg
options[:debug] = arg
end
# option to merge stdin/stdout into one buf? how should this work?
# option to ignore as-we-go yield output - this is off by default now except for success/fail
Expand All @@ -47,7 +49,9 @@ raise "Error, need command to run" if ARGV.size.zero?

m = MultipleCmd.new

targets = options[:range].split ","
range = Range::Client.new
targets = []
targets.push(*range.expand(options[:range]))

m.commands = targets.map { |t| ["/bin/sh", "-c"].push ARGV.map { |arg| arg.gsub('HOSTNAME', t)}.join " " }
command_to_target = Hash.new
Expand Down
3 changes: 2 additions & 1 deletion mssh/mssh.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "mssh"
s.version = "0.0.9"
s.version = "0.0.10"
s.platform = Gem::Platform::RUBY
s.authors = ["Evan Miller"]
s.email = ["github@squareup.com"]
Expand All @@ -13,6 +13,7 @@ Gem::Specification.new do |s|

s.add_dependency "json"
s.add_dependency "io-poll"
s.add_dependency "rangeclient"
s.default_executable = %q{mssh}
s.executables = %W{ mssh mcmd }

Expand Down