diff options
author | Andrew Cady <d@jerkface.net> | 2023-04-30 15:50:21 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2023-04-30 15:50:21 -0400 |
commit | ad4d6a06f32382b0417fe87cbb8afb420758130a (patch) | |
tree | d1af93711019007e741aaaf1b5d29e89b545873d | |
parent | 980715b4bab07c7602aaa50ef6f35daf17604a24 (diff) |
add more options
-rwxr-xr-x | ssh-check | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -49,7 +49,7 @@ main() | |||
49 | do | 49 | do |
50 | [ $# = 0 ] || match "$h" "$@" || continue | 50 | [ $# = 0 ] || match "$h" "$@" || continue |
51 | 51 | ||
52 | ( if uptime=$(ssh $SSH_OPTIONS -n "$h" -- uptime 2>/dev/null) | 52 | ( if uptime=$(ssh $SSH_OPTIONS -n "$h" -- ${REMOTE_COMMAND:-uptime} 2>/dev/null) |
53 | then | 53 | then |
54 | printf "%-15s %-${host_field_width}s %s\n" "Succeeded:" "$h" "${uptime# }" | 54 | printf "%-15s %-${host_field_width}s %s\n" "Succeeded:" "$h" "${uptime# }" |
55 | else | 55 | else |
@@ -79,14 +79,24 @@ edit_config() | |||
79 | rm "$f".timestamp | 79 | rm "$f".timestamp |
80 | } | 80 | } |
81 | 81 | ||
82 | usage() | ||
83 | { | ||
84 | cat <<EOF | ||
85 | Usage: $0 [--help | -h] [--verbose | -v] [--edit] [--run] [--] [host pattern] [...] | ||
86 | EOF | ||
87 | } | ||
88 | |||
82 | unset run_anyway do_edit | 89 | unset run_anyway do_edit |
83 | while [ $# -gt 0 ] | 90 | while [ $# -gt 0 ] |
84 | do | 91 | do |
85 | case "$1" in | 92 | case "$1" in |
86 | --edit) do_edit=y;; | 93 | --edit) do_edit=y;; |
87 | --run) run_anyway=y;; | 94 | --run) run_anyway=y;; |
95 | --help | -h) usage; exit;; | ||
96 | --command) REMOTE_COMMAND=$2; shift 2;; | ||
97 | --verbose | -v) VERBOSE=y; shift;; | ||
88 | --) shift; break;; | 98 | --) shift; break;; |
89 | -*) exit 1 ;; | 99 | -*) usage >&2; exit 1 ;; |
90 | *) break;; | 100 | *) break;; |
91 | esac | 101 | esac |
92 | shift | 102 | shift |