summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xrubyfy.rb16
2 files changed, 10 insertions, 8 deletions
diff --git a/README.md b/README.md
index 109e876..c762a0b 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Example usage:
```
cat serverlist.txt | ./rubyfy -p 10 -c 'hostname'
-./rubyfy -p 1 -c 'hostname' <<< foo.example.com
+./rubyfy --root --command 'id' <<< foo.example.com
```
diff --git a/rubyfy.rb b/rubyfy.rb
index 0548dd0..f9a7180 100755
--- a/rubyfy.rb
+++ b/rubyfy.rb
@@ -18,6 +18,8 @@ class Rubyfy
@args[opt] = arg
end
+ @args["--parallel"] = 1 unless @args["--parallel"]
+
log(:DEBUG, @args) if @args["--debug"]
end
@@ -65,13 +67,6 @@ class Rubyfy
private
- def log(severity, message)
- return if severity == :VERBOSE and not @args["--verbose"]
- @log_mutex.synchronize do
- puts "#{severity}::#{message}"
- end
- end
-
def run_command(server, command="uptime", root=false, user=ENV["USER"])
log(:VERBOSE,"#{server}::Connecting")
sudo = root ? "sudo " : ""
@@ -103,6 +98,13 @@ private
http = Net::HTTP.new(uri.host, uri.port)
http.request(req).body
end
+
+ def log(severity, message)
+ return if severity == :VERBOSE and not @args["--verbose"]
+ @log_mutex.synchronize do
+ puts "#{severity}::#{message}"
+ end
+ end
end
begin