File: ssh-ping.1

package info (click to toggle)
ssh-tools 1.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,328 kB
  • sloc: sh: 1,403; perl: 785; makefile: 5
file content (119 lines) | stat: -rw-r--r-- 2,670 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.TH SSH-PING "1" "March 2024" "SSH-TOOLS" "User Commands"
.SH NAME
ssh-ping \- check if host is reachable using ssh_config
.SH SYNOPSIS
ssh\-ping [OPTIONS] [user@]hostname
.SH DESCRIPTION
check if host is reachable using ssh_config
.SH OPTIONS
.TP
\fB\-4\fR
Use IPv4 only
.TP
\fB\-6\fR
Use IPv6 only
.TP
\fB\-c\fR count
Stop after sending <count> request packets
.TP
\fB\-C\fR
Connect as soon as the host responds
.br
and try reconnecting after a SSH session ends (e.g. rebooting).
.br
Useful also for IDRAC, IPMI, ILO devices, Switches, etc...
.br
which don't have a full shell environment.
.br
CTRL+C stops reconnect attempts.
.TP
\fB\-E\fR
Exit immediately after first successful ping
.br
(can be used to trigger a follow up task like rsync)
.TP
\fB\-F\fR configfile
Specifies an alternative per\-user configuration file.
.br
If a configuration file is given on the command line,
.br
the system\-wide configuration file ( \fI\,/etc/ssh/ssh_config\/\fP ) will be ignored.
.br
The default for the per\-user configuration file is ~/.ssh/config.
.TP
\fB\-h\fR
Show this message
.TP
\fB\-i\fR interval
Wait <interval> seconds between sending each request.
.br
The default is 1 second.
.TP
\fB\-l\fR user
Try login with <user> as username. The default is the current value of $USER.
.TP
\fB\-D\fR
Print timestamp (unix time + microseconds as in gettimeofday) before each line
.TP
\fB\-H\fR
Print timestamp (human readable) before each line
.TP
\fB\-W\fR timeout
Time to wait for a response, in seconds
.TP
\fB\-p\fR port
Port to connect to on the remote host.
.br
This can be specified on a per\-host basis in the configuration file.
.TP
\fB\-q\fR
Quiet output.
.br
Nothing is displayed except the summary lines at startup time and when finished
.TP
\fB\-n\fR
No colors.
.br
(e.g. for black on white terminals)
.TP
\fB\-v\fR
Verbose output
.TP
\fB\--version\fR
show version information
.SH TAB_COMPLETIONS
Ubuntu (and maybe other distros) already ship
.br
shell completions for ssh which can be used:
.TP
\fBBash\fR
complete \fB\-F\fR _known_hosts ssh\-ping
.TP
\fBZsh\fR
compdef _ssh_hosts ssh\-ping
.TP
\fBFish\fR
complete \fB\-c\fR ssh\-ping \fB\-a\fR "(__fish_print_hostnames)"
.SH ENVIRONMENT
.TP
SSH_PING_NO_COLORS
if set, no colors are shown (like \fB\-n\fR)
.SH EXIT_CODES
.TP
0
No requests lost
.TP
1
More than 1 request lost
.TP
2
All requests lost
.SH EXAMPLES
.TP
ssh\-ping \fB\-E\fR hostname && echo "First successful ping. Starting rsync..."
.TP
ssh\-ping \fB\-q\fR \fB\-c\fR 1 hostname >/dev/null && echo "Host is up!"
.TP
ssh\-ping \fB\-q\fR \fB\-c\fR 1 hostname >/dev/null || echo "Host is down!"
.TP
SSH_PING_NO_COLORS=true ssh\-ping \fB\-c\fR 1 hostname