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
120
121
122
123
124
125
126
127
128
129
130
131
132
|
'\" t
.\" Title: nm-online
.\" Author:
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\" Date: 03/22/2022
.\" Manual: General Commands Manual
.\" Source: NetworkManager 1.36.4
.\" Language: English
.\"
.TH "NM\-ONLINE" "1" "" "NetworkManager 1\&.36\&.4" "General Commands Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
nm-online \- ask NetworkManager whether the network is connected
.SH "SYNOPSIS"
.HP \w'\fBnm\-online\fR\ 'u
\fBnm\-online\fR [\fIOPTIONS\fR...]
.SH "DESCRIPTION"
.PP
\fBnm\-online\fR
is a utility to find out whether we are online\&. It is done by asking NetworkManager about its status\&. When run,
\fBnm\-online\fR
waits until NetworkManager reports an active connection, or specified timeout expires\&. On exit, the returned status code should be checked (see the return codes below)\&.
.PP
This tool is not very useful to call directly\&. It is however used by
NetworkManager\-wait\-online\&.service
with
\-\-wait\-for\-startup
argument\&. This is used to delay the service and indirectly
network\-online\&.target, until networking is up\&. Don\*(Aqt order your own systemd services after
NetworkManager\-wait\-online\&.service
directly\&. Instead if necessary, order your services after
network\-online\&.target\&. Even better is to have your services react to network changes dynamically and don\*(Aqt order them with respect to
network\-online\&.target
at all\&.
.PP
By default, connections have the
ipv4\&.may\-fail
and
ipv6\&.may\-fail
properties set to
yes; this means that NetworkManager waits for one of the two address families to complete configuration before considering the connection activated\&. If you need a specific address family configured before
network\-online\&.target
is reached, set the corresponding
may\-fail
property to
no\&.
.SH "OPTIONS"
.PP
\fB\-h\fR | \fB\-\-help\fR
.RS 4
Print help information\&.
.RE
.PP
\fB\-q\fR | \fB\-\-quiet\fR
.RS 4
Don\*(Aqt print anything\&.
.RE
.PP
\fB\-s\fR | \fB\-\-wait\-for\-startup\fR
.RS 4
Wait for NetworkManager startup to complete, rather than waiting for network connectivity specifically\&. Startup is considered complete once NetworkManager has activated (or attempted to activate) every auto\-activate connection which is available given the current network state\&. This corresponds to the moment when NetworkManager logs
"startup complete"\&. This mode is generally only useful at boot time\&. After startup has completed,
\fBnm\-online \-s\fR
will just return immediately, regardless of the current network state\&.
.sp
There are various ways to affect when startup complete is reached\&. For example, by setting a connection profile to autoconnect, such a profile possibly will activate during startup and thus delay startup complete being reached\&. Also, a profile is considered ready when it fully reached the logical
connected
state in NetworkManager\&. That means, properties like
ipv4\&.may\-fail
and
ipv6\&.may\-fail
affect whether a certain address family is required\&. Also, the connection property
connection\&.wait\-device\-timeout
affects whether to wait for the driver to detect a certain device\&. Generally, a failure of
NetworkManager\-wait\-online\&.service
indicates a configuration error, where NetworkManager won\*(Aqt be able to reach the desired connectivity state during startup\&. An example for that are bridge or bond master profiles, that get autoconnected but without activating any slaves\&. Such master devices hang in activating state indefinitely, and cause
NetworkManager\-wait\-online\&.service
to fail\&.
.RE
.PP
\fB\-t\fR | \fB\-\-timeout\fR \fIseconds\fR
.RS 4
Time to wait for a connection, in seconds\&. If the option is not provided, the environment variable
NM_ONLINE_TIMEOUT
is honored\&. The default timeout is 30 seconds\&.
.RE
.PP
\fB\-x\fR | \fB\-\-exit\fR
.RS 4
Exit immediately if NetworkManager is not running or connecting\&.
.RE
.SH "EXIT STATUS"
.PP
\fBnm\-online\fR
exits with status 0 if it succeeds, a value greater than 0 is returned if an error occurs\&.
.PP
\fB0\fR
.RS 4
Success \(en already online or connection established within given timeout\&.
.RE
.PP
\fB1\fR
.RS 4
Offline or not online within given timeout\&.
.RE
.PP
\fB2\fR
.RS 4
Unknown or unspecified error\&.
.RE
.SH "SEE ALSO"
.PP
\fBnmcli\fR(1),
\fBNetworkManager\fR(8)\&.
|