rcmd 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.bundle/config +1 -0
- data/.gitignore +1 -0
- data/.rspec_status +9 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +55 -0
- data/README.md +84 -0
- data/Rakefile +37 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/rdocs/OptionParser.html +124 -0
- data/doc/rdocs/README_md.html +212 -0
- data/doc/rdocs/Rcmd.html +362 -0
- data/doc/rdocs/created.rid +5 -0
- data/doc/rdocs/images/add.png +0 -0
- data/doc/rdocs/images/arrow_up.png +0 -0
- data/doc/rdocs/images/brick.png +0 -0
- data/doc/rdocs/images/brick_link.png +0 -0
- data/doc/rdocs/images/bug.png +0 -0
- data/doc/rdocs/images/bullet_black.png +0 -0
- data/doc/rdocs/images/bullet_toggle_minus.png +0 -0
- data/doc/rdocs/images/bullet_toggle_plus.png +0 -0
- data/doc/rdocs/images/date.png +0 -0
- data/doc/rdocs/images/delete.png +0 -0
- data/doc/rdocs/images/find.png +0 -0
- data/doc/rdocs/images/loadingAnimation.gif +0 -0
- data/doc/rdocs/images/macFFBgHack.png +0 -0
- data/doc/rdocs/images/package.png +0 -0
- data/doc/rdocs/images/page_green.png +0 -0
- data/doc/rdocs/images/page_white_text.png +0 -0
- data/doc/rdocs/images/page_white_width.png +0 -0
- data/doc/rdocs/images/plugin.png +0 -0
- data/doc/rdocs/images/ruby.png +0 -0
- data/doc/rdocs/images/tag_blue.png +0 -0
- data/doc/rdocs/images/tag_green.png +0 -0
- data/doc/rdocs/images/transparent.png +0 -0
- data/doc/rdocs/images/wrench.png +0 -0
- data/doc/rdocs/images/wrench_orange.png +0 -0
- data/doc/rdocs/images/zoom.png +0 -0
- data/doc/rdocs/index.html +191 -0
- data/doc/rdocs/js/darkfish.js +155 -0
- data/doc/rdocs/js/jquery.js +4 -0
- data/doc/rdocs/js/navigation.js +142 -0
- data/doc/rdocs/js/search.js +94 -0
- data/doc/rdocs/js/search_index.js +1 -0
- data/doc/rdocs/js/searcher.js +228 -0
- data/doc/rdocs/rdoc.css +595 -0
- data/doc/rdocs/table_of_contents.html +71 -0
- data/exe/rcmd +73 -0
- data/lib/rcmd.rb +123 -0
- data/lib/rcmd/version.rb +4 -0
- data/rcmd.gemspec +46 -0
- metadata +204 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 1b72a21c020c10acb74666026f1e467897d46c73
|
|
4
|
+
data.tar.gz: 429163584d6ac0aab5b86ac47be0c1b8f3d57e6e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 931dc47e776a37e65df2a2e41c491e576a5e4772825a8656aaa00d20989fef2e0e6ac59c763a490925875e309585e77014ab9750fb8e30358fa5f83efad49b8b
|
|
7
|
+
data.tar.gz: f051f803433b11282bf47cfaac31278b9c7058e3046546dea76bac599c227d8bedde48f4a36c3e99055a69a90cab968c9a0a0da0f2705e26b9ffdb1282989166
|
data/.bundle/config
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
---
|
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pkg/*
|
data/.rspec_status
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
example_id | status | run_time |
|
|
2
|
+
------------------------ | ------ | --------------- |
|
|
3
|
+
./spec/rcmd_spec.rb[1:1] | passed | 0.00046 seconds |
|
|
4
|
+
./spec/rcmd_spec.rb[1:2] | passed | 0.00089 seconds |
|
|
5
|
+
./spec/rcmd_spec.rb[1:3] | passed | 0.00056 seconds |
|
|
6
|
+
./spec/rcmd_spec.rb[1:4] | passed | 0.00009 seconds |
|
|
7
|
+
./spec/rcmd_spec.rb[1:5] | passed | 0.00007 seconds |
|
|
8
|
+
./spec/rcmd_spec.rb[1:6] | passed | 0.0008 seconds |
|
|
9
|
+
./spec/rcmd_spec.rb[1:7] | passed | 0.0001 seconds |
|
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rcmd
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-2.0.0-p648
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
rcmd (1.5.6)
|
|
5
|
+
io-console
|
|
6
|
+
net-ssh
|
|
7
|
+
thread
|
|
8
|
+
tty-prompt
|
|
9
|
+
|
|
10
|
+
GEM
|
|
11
|
+
remote: https://rubygems.org/
|
|
12
|
+
specs:
|
|
13
|
+
diff-lcs (1.3)
|
|
14
|
+
equatable (0.5.0)
|
|
15
|
+
io-console (0.4.2)
|
|
16
|
+
necromancer (0.4.0)
|
|
17
|
+
net-ssh (4.1.0)
|
|
18
|
+
pastel (0.7.1)
|
|
19
|
+
equatable (~> 0.5.0)
|
|
20
|
+
tty-color (~> 0.4.0)
|
|
21
|
+
rake (10.5.0)
|
|
22
|
+
rspec (3.6.0)
|
|
23
|
+
rspec-core (~> 3.6.0)
|
|
24
|
+
rspec-expectations (~> 3.6.0)
|
|
25
|
+
rspec-mocks (~> 3.6.0)
|
|
26
|
+
rspec-core (3.6.0)
|
|
27
|
+
rspec-support (~> 3.6.0)
|
|
28
|
+
rspec-expectations (3.6.0)
|
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
30
|
+
rspec-support (~> 3.6.0)
|
|
31
|
+
rspec-mocks (3.6.0)
|
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
33
|
+
rspec-support (~> 3.6.0)
|
|
34
|
+
rspec-support (3.6.0)
|
|
35
|
+
thread (0.2.2)
|
|
36
|
+
tty-color (0.4.2)
|
|
37
|
+
tty-cursor (0.4.0)
|
|
38
|
+
tty-prompt (0.12.0)
|
|
39
|
+
necromancer (~> 0.4.0)
|
|
40
|
+
pastel (~> 0.7.0)
|
|
41
|
+
tty-cursor (~> 0.4.0)
|
|
42
|
+
wisper (~> 1.6.1)
|
|
43
|
+
wisper (1.6.1)
|
|
44
|
+
|
|
45
|
+
PLATFORMS
|
|
46
|
+
ruby
|
|
47
|
+
|
|
48
|
+
DEPENDENCIES
|
|
49
|
+
bundler (~> 1.15)
|
|
50
|
+
rake (~> 10.0)
|
|
51
|
+
rcmd!
|
|
52
|
+
rspec (~> 3.0, >= 2.0.0)
|
|
53
|
+
|
|
54
|
+
BUNDLED WITH
|
|
55
|
+
1.15.1
|
data/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Description
|
|
2
|
+
|
|
3
|
+
rcmd (remote command) is a command line utility written in Ruby for executing the same command on
|
|
4
|
+
multiple systems through ssh. This is done by assigning a host to a
|
|
5
|
+
thread and creating the ssh sessions in those threads.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Command line switch for setting number of threads to be used at a time. (Default is 4)
|
|
10
|
+
- A comma seperated list of hosts piped from another command can be used as the node list.
|
|
11
|
+
- Username can be specified. (Default is root. Requires valid ssh-key in ~/.ssh)
|
|
12
|
+
- Output shows which host the output is from
|
|
13
|
+
- Stdout can be suppressed, only allowing for stderr to be shown
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
rcmd is available as a gem and kan be installed with `gem install rcmd`
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Usage Examples
|
|
20
|
+
|
|
21
|
+
## Help Screen
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
daibhidh@darkstar:~/$ rcmd --help
|
|
25
|
+
Usage: rcmd [options]
|
|
26
|
+
-u, --username username Username for SSH connections
|
|
27
|
+
-n, --nodes x,y,z Comma seperated list of nodes. use '-' for a space seperated list piped from another command
|
|
28
|
+
-t, --threads threads Number of threads to run
|
|
29
|
+
-c, --command <command> Quoted string containing the command to be run
|
|
30
|
+
-q, --quiet Suppress stdout of commands. stderr will still be displayed
|
|
31
|
+
-v, --version Print what version of the command is in use
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Specifying nodes manually
|
|
35
|
+
Specifying a comma seperated list of hosts and timing the total execution time.
|
|
36
|
+
```bash
|
|
37
|
+
daibhidh@darkstar:~/$ time rcmd -n node1,node2,node3,node4 -c 'cat /etc/redhat-release'
|
|
38
|
+
node2 :: Red Hat Enterprise Linux ComputeNode release 6.8 (Santiago)
|
|
39
|
+
node1 :: Red Hat Enterprise Linux ComputeNode release 6.8 (Santiago)
|
|
40
|
+
node4 :: Red Hat Enterprise Linux ComputeNode release 6.9 (Santiago)
|
|
41
|
+
node3 :: Red Hat Enterprise Linux ComputeNode release 6.9 (Santiago)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
real 0m2.749s
|
|
45
|
+
user 0m0.272s
|
|
46
|
+
sys 0m0.050s
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Piping list of nodes
|
|
50
|
+
Using the hammer cli to get a list of hosts from a RedHat Satellite and providing it to rcmd as the node list.
|
|
51
|
+
```bash
|
|
52
|
+
daibhidh@darkstar:~/$ hammer --output base host list --organization org | awk '/Name:/ {print $2}' | rcmd -n - -c 'cat /etc/redhat-release'
|
|
53
|
+
node1.example.com :: Red Hat Enterprise Linux ComputeNode release 6.8 (Santiago)
|
|
54
|
+
node3.example.com :: Red Hat Enterprise Linux ComputeNode release 6.9 (Santiago)
|
|
55
|
+
node2.example.com :: Red Hat Enterprise Linux ComputeNode release 6.8 (Santiago)
|
|
56
|
+
node4.example.com :: Red Hat Enterprise Linux ComputeNode release 6.9 (Santiago)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Using a database for obtaining nodes
|
|
60
|
+
TODO
|
|
61
|
+
|
|
62
|
+
# Development
|
|
63
|
+
|
|
64
|
+
If you are wanting to modify the code by all means do so. If you clone this repository you can then run `bundle install` to install the dependencies needed. Tests are performed with *rspec* and can be run with *rake*.
|
|
65
|
+
|
|
66
|
+
Available Rake tasks are:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
rake build # Build rcmd-1.5.5.gem into the pkg directory
|
|
70
|
+
rake clean # Remove any temporary products
|
|
71
|
+
rake clobber # Remove any generated files
|
|
72
|
+
rake clobber_rdoc # Remove RDoc HTML files
|
|
73
|
+
rake console # Open an IRB console with this gem loaded
|
|
74
|
+
rake install # Build and install rcmd-1.5.5.gem into system gems
|
|
75
|
+
rake install:local # Build and install rcmd-1.5.5.gem into system gems without network access
|
|
76
|
+
rake rdoc # Build RDoc HTML files
|
|
77
|
+
rake reinstall # Remove, build, and install gem
|
|
78
|
+
rake release[remote] # Create tag v1.5.5 and build and push rcmd-1.5.5.gem to Rubygems
|
|
79
|
+
rake rerdoc # Rebuild RDoc HTML files
|
|
80
|
+
rake spec # Run RSpec code examples
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
require 'rdoc/task'
|
|
4
|
+
|
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
6
|
+
|
|
7
|
+
task :default => :spec
|
|
8
|
+
|
|
9
|
+
desc "Open an IRB console with this gem loaded"
|
|
10
|
+
task :console do
|
|
11
|
+
require 'irb'
|
|
12
|
+
require 'irb/completion'
|
|
13
|
+
require 'rcmd' # You know what to do.
|
|
14
|
+
ARGV.clear
|
|
15
|
+
IRB.start
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
desc "Remove, build, and install gem"
|
|
19
|
+
task :reinstall do
|
|
20
|
+
puts "Uninstalling #{`gem list rcmd`}"
|
|
21
|
+
`gem uninstall -x rcmd`
|
|
22
|
+
Rake::Task["install"].reenable
|
|
23
|
+
Rake::Task["install"].invoke
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
desc 'generate API documentation to doc/rdocs/index.html'
|
|
27
|
+
|
|
28
|
+
Rake::RDocTask.new do |rd|
|
|
29
|
+
rd.rdoc_dir = 'doc/rdocs'
|
|
30
|
+
rd.main = 'README.md'
|
|
31
|
+
rd.rdoc_files.include 'README.md', "lib/**/*\.rb", "exe/**/*"
|
|
32
|
+
|
|
33
|
+
rd.options << '--inline-source'
|
|
34
|
+
rd.options << '--line-numbers'
|
|
35
|
+
rd.options << '--all'
|
|
36
|
+
end
|
|
37
|
+
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "rcmd"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
|
6
|
+
|
|
7
|
+
<title>module OptionParser - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
|
10
|
+
|
|
11
|
+
<script type="text/javascript">
|
|
12
|
+
var rdoc_rel_prefix = "./";
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<body id="top" class="module">
|
|
24
|
+
<nav id="metadata">
|
|
25
|
+
<nav id="home-section" class="section">
|
|
26
|
+
<h3 class="section-header">
|
|
27
|
+
<a href="./index.html">Home</a>
|
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
|
30
|
+
</h3>
|
|
31
|
+
</nav>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
36
|
+
<h3 class="section-header">
|
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
39
|
+
</h3>
|
|
40
|
+
</form>
|
|
41
|
+
|
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
|
43
|
+
</nav>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<div id="file-metadata">
|
|
49
|
+
<nav id="file-list-section" class="section">
|
|
50
|
+
<h3 class="section-header">Defined In</h3>
|
|
51
|
+
<ul>
|
|
52
|
+
<li>exe/rcmd
|
|
53
|
+
</ul>
|
|
54
|
+
</nav>
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div id="class-metadata">
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div id="project-metadata">
|
|
68
|
+
<nav id="fileindex-section" class="section project-section">
|
|
69
|
+
<h3 class="section-header">Pages</h3>
|
|
70
|
+
|
|
71
|
+
<ul>
|
|
72
|
+
|
|
73
|
+
<li class="file"><a href="./README_md.html">README</a>
|
|
74
|
+
|
|
75
|
+
</ul>
|
|
76
|
+
</nav>
|
|
77
|
+
|
|
78
|
+
<nav id="classindex-section" class="section project-section">
|
|
79
|
+
<h3 class="section-header">Class and Module Index</h3>
|
|
80
|
+
|
|
81
|
+
<ul class="link-list">
|
|
82
|
+
|
|
83
|
+
<li><a href="./OptionParser.html">OptionParser</a>
|
|
84
|
+
|
|
85
|
+
<li><a href="./Rcmd.html">Rcmd</a>
|
|
86
|
+
|
|
87
|
+
</ul>
|
|
88
|
+
</nav>
|
|
89
|
+
|
|
90
|
+
</div>
|
|
91
|
+
</nav>
|
|
92
|
+
|
|
93
|
+
<div id="documentation">
|
|
94
|
+
<h1 class="module">module OptionParser</h1>
|
|
95
|
+
|
|
96
|
+
<div id="description" class="description">
|
|
97
|
+
|
|
98
|
+
</div><!-- description -->
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
<!-- Methods -->
|
|
113
|
+
|
|
114
|
+
</section><!-- 5Buntitled-5D -->
|
|
115
|
+
|
|
116
|
+
</div><!-- documentation -->
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
<footer id="validator-badges">
|
|
120
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
|
121
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
|
|
122
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
|
123
|
+
</footer>
|
|
124
|
+
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
|
6
|
+
|
|
7
|
+
<title>README - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
|
10
|
+
|
|
11
|
+
<script type="text/javascript">
|
|
12
|
+
var rdoc_rel_prefix = "./";
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<body class="file">
|
|
24
|
+
<nav id="metadata">
|
|
25
|
+
<nav id="home-section" class="section">
|
|
26
|
+
<h3 class="section-header">
|
|
27
|
+
<a href="./index.html">Home</a>
|
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
|
30
|
+
</h3>
|
|
31
|
+
</nav>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
36
|
+
<h3 class="section-header">
|
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
39
|
+
</h3>
|
|
40
|
+
</form>
|
|
41
|
+
|
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
|
43
|
+
</nav>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
<div id="table-of-contents">
|
|
48
|
+
<nav class="section">
|
|
49
|
+
<h3 class="section-header">Table of Contents</h3>
|
|
50
|
+
<ul>
|
|
51
|
+
<li><a href="#label-Description">Description</a>
|
|
52
|
+
<li><a href="#label-Features">Features</a>
|
|
53
|
+
<li><a href="#label-Installation">Installation</a>
|
|
54
|
+
<li><a href="#label-Usage+Examples">Usage Examples</a>
|
|
55
|
+
<li><a href="#label-Help+Screen">Help Screen</a>
|
|
56
|
+
<li><a href="#label-Specifying+nodes+manually">Specifying nodes manually</a>
|
|
57
|
+
<li><a href="#label-Piping+list+of+nodes">Piping list of nodes</a>
|
|
58
|
+
<li><a href="#label-Using+a+database+for+obtaining+nodes">Using a database for obtaining nodes</a>
|
|
59
|
+
<li><a href="#label-Development">Development</a>
|
|
60
|
+
</ul>
|
|
61
|
+
</nav>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
<div id="project-metadata">
|
|
66
|
+
<nav id="fileindex-section" class="section project-section">
|
|
67
|
+
<h3 class="section-header">Pages</h3>
|
|
68
|
+
|
|
69
|
+
<ul>
|
|
70
|
+
|
|
71
|
+
<li class="file"><a href="./README_md.html">README</a>
|
|
72
|
+
|
|
73
|
+
</ul>
|
|
74
|
+
</nav>
|
|
75
|
+
|
|
76
|
+
<nav id="classindex-section" class="section project-section">
|
|
77
|
+
<h3 class="section-header">Class and Module Index</h3>
|
|
78
|
+
|
|
79
|
+
<ul class="link-list">
|
|
80
|
+
|
|
81
|
+
<li><a href="./OptionParser.html">OptionParser</a>
|
|
82
|
+
|
|
83
|
+
<li><a href="./Rcmd.html">Rcmd</a>
|
|
84
|
+
|
|
85
|
+
</ul>
|
|
86
|
+
</nav>
|
|
87
|
+
|
|
88
|
+
</div>
|
|
89
|
+
</nav>
|
|
90
|
+
|
|
91
|
+
<div id="documentation" class="description">
|
|
92
|
+
|
|
93
|
+
<h1 id="label-Description">Description<span><a href="#label-Description">¶</a> <a href="#documentation">↑</a></span></h1>
|
|
94
|
+
|
|
95
|
+
<p>rcmd (remote command) is a command line utility written in Ruby for
|
|
96
|
+
executing the same command on
|
|
97
|
+
multiple systems through ssh. This is done by
|
|
98
|
+
assigning a host to a
|
|
99
|
+
thread and creating the ssh sessions in those
|
|
100
|
+
threads.</p>
|
|
101
|
+
|
|
102
|
+
<h2 id="label-Features">Features<span><a href="#label-Features">¶</a> <a href="#documentation">↑</a></span></h2>
|
|
103
|
+
<ul><li>
|
|
104
|
+
<p>Command line switch for setting number of threads to be used at a time.
|
|
105
|
+
(Default is 4)</p>
|
|
106
|
+
</li><li>
|
|
107
|
+
<p>A comma seperated list of hosts piped from another command can be used as
|
|
108
|
+
the node list.</p>
|
|
109
|
+
</li><li>
|
|
110
|
+
<p>Username can be specified. (Default is root. Requires valid ssh-key in
|
|
111
|
+
~/.ssh)</p>
|
|
112
|
+
</li><li>
|
|
113
|
+
<p>Output shows which host the output is from</p>
|
|
114
|
+
</li><li>
|
|
115
|
+
<p>Stdout can be suppressed, only allowing for stderr to be shown</p>
|
|
116
|
+
</li></ul>
|
|
117
|
+
|
|
118
|
+
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#documentation">↑</a></span></h2>
|
|
119
|
+
|
|
120
|
+
<p>rcmd is available as a gem and kan be installed with <code>gem install
|
|
121
|
+
rcmd</code></p>
|
|
122
|
+
|
|
123
|
+
<h1 id="label-Usage+Examples">Usage Examples<span><a href="#label-Usage+Examples">¶</a> <a href="#documentation">↑</a></span></h1>
|
|
124
|
+
|
|
125
|
+
<h2 id="label-Help+Screen">Help Screen<span><a href="#label-Help+Screen">¶</a> <a href="#documentation">↑</a></span></h2>
|
|
126
|
+
|
|
127
|
+
<pre>daibhidh@darkstar:~/$ rcmd --help
|
|
128
|
+
Usage: rcmd [options]
|
|
129
|
+
-u, --username username Username for SSH connections
|
|
130
|
+
-n, --nodes x,y,z Comma seperated list of nodes. use '-' for a space seperated list piped from another command
|
|
131
|
+
-t, --threads threads Number of threads to run
|
|
132
|
+
-c, --command <command> Quoted string containing the command to be run
|
|
133
|
+
-q, --quiet Suppress stdout of commands. stderr will still be displayed
|
|
134
|
+
-v, --version Print what version of the command is in use</pre>
|
|
135
|
+
|
|
136
|
+
<h2 id="label-Specifying+nodes+manually">Specifying nodes manually<span><a href="#label-Specifying+nodes+manually">¶</a> <a href="#documentation">↑</a></span></h2>
|
|
137
|
+
|
|
138
|
+
<p>Specifying a comma seperated list of hosts and timing the total execution
|
|
139
|
+
time.
|
|
140
|
+
```bash
|
|
141
|
+
daibhidh@darkstar:~/$ time rcmd -n node1,node2,node3,node4 -c
|
|
142
|
+
'cat /etc/redhat-release'
|
|
143
|
+
node2 :: Red Hat Enterprise Linux
|
|
144
|
+
ComputeNode release 6.8 (Santiago)
|
|
145
|
+
node1 :: Red Hat Enterprise Linux
|
|
146
|
+
ComputeNode release 6.8 (Santiago)
|
|
147
|
+
node4 :: Red Hat Enterprise Linux
|
|
148
|
+
ComputeNode release 6.9 (Santiago)
|
|
149
|
+
node3 :: Red Hat Enterprise Linux
|
|
150
|
+
ComputeNode release 6.9 (Santiago)</p>
|
|
151
|
+
|
|
152
|
+
<p>real 0m2.749s
|
|
153
|
+
user 0m0.272s
|
|
154
|
+
sys 0m0.050s
|
|
155
|
+
```</p>
|
|
156
|
+
|
|
157
|
+
<h2 id="label-Piping+list+of+nodes">Piping list of nodes<span><a href="#label-Piping+list+of+nodes">¶</a> <a href="#documentation">↑</a></span></h2>
|
|
158
|
+
|
|
159
|
+
<p>Using the hammer cli to get a list of hosts from a RedHat Satellite and
|
|
160
|
+
providing it to rcmd as the node
|
|
161
|
+
list.
|
|
162
|
+
<code>bash
|
|
163
|
+
daibhidh@darkstar:~/$ hammer --output base host list
|
|
164
|
+
--organization org | awk '/Name:/ {print $2}' | rcmd -n - -c
|
|
165
|
+
'cat /etc/redhat-release'
|
|
166
|
+
node1.example.com :: Red Hat Enterprise
|
|
167
|
+
Linux ComputeNode release 6.8 (Santiago)
|
|
168
|
+
node3.example.com :: Red Hat
|
|
169
|
+
Enterprise Linux ComputeNode release 6.9 (Santiago)
|
|
170
|
+
node2.example.com ::
|
|
171
|
+
Red Hat Enterprise Linux ComputeNode release 6.8
|
|
172
|
+
(Santiago)
|
|
173
|
+
node4.example.com :: Red Hat Enterprise Linux ComputeNode
|
|
174
|
+
release 6.9 (Santiago)
|
|
175
|
+
</code></p>
|
|
176
|
+
|
|
177
|
+
<h2 id="label-Using+a+database+for+obtaining+nodes">Using a database for obtaining nodes<span><a href="#label-Using+a+database+for+obtaining+nodes">¶</a> <a href="#documentation">↑</a></span></h2>
|
|
178
|
+
|
|
179
|
+
<p>TODO</p>
|
|
180
|
+
|
|
181
|
+
<h1 id="label-Development">Development<span><a href="#label-Development">¶</a> <a href="#documentation">↑</a></span></h1>
|
|
182
|
+
|
|
183
|
+
<p>If you are wanting to modify the code by all means do so. If you clone this
|
|
184
|
+
repository you can then run <code>bundle install</code> to install the
|
|
185
|
+
dependencies needed. Tests are performed with <em>rspec</em> and can be run
|
|
186
|
+
with <em>rake</em>.</p>
|
|
187
|
+
|
|
188
|
+
<p>Available Rake tasks are:</p>
|
|
189
|
+
|
|
190
|
+
<pre>rake build # Build rcmd-1.5.5.gem into the pkg directory
|
|
191
|
+
rake clean # Remove any temporary products
|
|
192
|
+
rake clobber # Remove any generated files
|
|
193
|
+
rake clobber_rdoc # Remove RDoc HTML files
|
|
194
|
+
rake console # Open an IRB console with this gem loaded
|
|
195
|
+
rake install # Build and install rcmd-1.5.5.gem into system gems
|
|
196
|
+
rake install:local # Build and install rcmd-1.5.5.gem into system gems without network access
|
|
197
|
+
rake rdoc # Build RDoc HTML files
|
|
198
|
+
rake reinstall # Remove, build, and install gem
|
|
199
|
+
rake release[remote] # Create tag v1.5.5 and build and push rcmd-1.5.5.gem to Rubygems
|
|
200
|
+
rake rerdoc # Rebuild RDoc HTML files
|
|
201
|
+
rake spec # Run RSpec code examples</pre>
|
|
202
|
+
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<footer id="validator-badges">
|
|
208
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
|
209
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
|
|
210
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
|
211
|
+
</footer>
|
|
212
|
+
|