Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gavincarr/sshr
Flexible ssh wrapper for executing commands on multiple hosts
https://github.com/gavincarr/sshr
Last synced: 28 days ago
JSON representation
Flexible ssh wrapper for executing commands on multiple hosts
- Host: GitHub
- URL: https://github.com/gavincarr/sshr
- Owner: gavincarr
- License: other
- Created: 2010-12-08T16:22:03.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2015-10-30T23:29:39.000Z (about 9 years ago)
- Last Synced: 2023-03-11T08:12:42.195Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 234 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: COPYING
Awesome Lists containing this project
README
Introduction
------------sshr is an asynchronous ssh utility for executing a command on multiple
hosts and flexibly collating and presenting the results.Net::SSHR is a rubygem that that does all the actual work. It's basically a
thin wrapper around Net::SSH::Multi optimised for this particular use case.sshr
----Synopsis:
sshr [options] [ ...]
sshr [options] [ ...] -- [ ...]Options:
-u, --user=USER Default user for ssh connections
-t, --pty Request pseudo-tty allocation on ssh channels
-l, --long Report long/full command output
-s, --short Report short command output (first line only)
-j, --json Report results as json
-L, --list Report hosts that produce output (and nothing else)
-m, --merge Merge output before reporting
-o, --out, --stdout Show only stdout, not stderr
-e, --err, --stderr Show only stderr, not stdout
-b, --oeb, --oe Show both stdout and stderr (default with --long)
-x, --oex Show either stdout or stderr, but not both (xor) (default with --short)
-H, --show-hostname Show hostname with output
-h, --no-hostname Omit hostname from output
--stream Annotate stdout and stderr streams to distinguish them
-q, --quiet Omit hosts that don't produce any output
-v, --verbose More verbose output (for debugging)Net::SSHR
---------Synopsis:
require 'net/sshr'
include SSHR# sshr_exec: run a command on multiple hosts
sshr_exec(%w{ host1 host2 }, 'uptime') do |result|
puts "#{result.host}: #{result.exit_code}"
puts #{result.stdout}
end
# sshr_exec_list: run arbitrary sets of host-command pairs
sshr_exec_list(
'host1', 'uptime',
'host1', 'rpm -q ruby',
'host2', 'date',
'host3', 'uname -r'
) do |result|
puts "#{result.host}: #{result.exit_code}"
puts #{result.stdout}
end
# Trivial single-host usage
result = sshr_exec('host', 'date')
puts resultSee Also
--------Net::SSHR, Net::SSHR::Result, Net::SSH::Multi
Author
------Copyright 2010-2015 Gavin Carr
Licence
-------sshr and Net::SSHR are free software; you can redistribute and/or modify them
under the same terms as ruby (see COPYING for details).