| 1 |
<?xml version='1.0'?> |
| 2 |
<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?> |
| 3 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 4 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ |
| 5 |
<!ENTITY % entities SYSTEM "common.ent" > |
| 6 |
%entities; |
| 7 |
]> |
| 8 |
|
| 9 |
<!-- |
| 10 |
SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later |
| 11 |
|
| 12 |
nm-online(1) manual page |
| 13 |
|
| 14 |
Copyright 2010 - 2016 Red Hat, Inc. |
| 15 |
--> |
| 16 |
|
| 17 |
<refentry id='nm-online'> |
| 18 |
|
| 19 |
<refentryinfo> |
| 20 |
<title>nm-online</title> |
| 21 |
<author>NetworkManager developers</author> |
| 22 |
</refentryinfo> |
| 23 |
|
| 24 |
<refmeta> |
| 25 |
<refentrytitle>nm-online</refentrytitle> |
| 26 |
<manvolnum>1</manvolnum> |
| 27 |
<refmiscinfo class="source">NetworkManager</refmiscinfo> |
| 28 |
<refmiscinfo class="manual">General Commands Manual</refmiscinfo> |
| 29 |
<refmiscinfo class="version">&NM_VERSION;</refmiscinfo> |
| 30 |
</refmeta> |
| 31 |
|
| 32 |
<refnamediv> |
| 33 |
<refname>nm-online</refname> |
| 34 |
<refpurpose>ask NetworkManager whether the network is connected</refpurpose> |
| 35 |
</refnamediv> |
| 36 |
|
| 37 |
<refsynopsisdiv id='synopsis'> |
| 38 |
<cmdsynopsis> |
| 39 |
<command>nm-online</command> |
| 40 |
<arg choice="opt" rep="repeat"><replaceable>OPTIONS</replaceable></arg> |
| 41 |
</cmdsynopsis> |
| 42 |
</refsynopsisdiv> |
| 43 |
|
| 44 |
<refsect1 id='description'><title>Description</title> |
| 45 |
<para><command>nm-online</command> is a utility to find out whether we are |
| 46 |
online. It is done by asking NetworkManager about its status. When run, |
| 47 |
<command>nm-online</command> waits until NetworkManager reports an active |
| 48 |
connection, or specified timeout expires. On exit, the returned status code |
| 49 |
should be checked (see the return codes below).</para> |
| 50 |
|
| 51 |
<para>This tool is not very useful to call directly. It is however used by |
| 52 |
<literal>NetworkManager-wait-online.service</literal> with |
| 53 |
<literal>--wait-for-startup</literal> argument |
| 54 |
(see <link linkend='NetworkManager-wait-online.service'><citerefentry><refentrytitle>NetworkManager-wait-online.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></link>). |
| 55 |
</para> |
| 56 |
|
| 57 |
<para>By default, connections have the <literal>ipv4.may-fail</literal> and |
| 58 |
<literal>ipv6.may-fail</literal> properties set to <literal>yes</literal>; |
| 59 |
this means that NetworkManager waits for one of the two address families to |
| 60 |
complete configuration before considering the connection activated. If you |
| 61 |
need a specific address family configured before |
| 62 |
<literal>network-online.target</literal> is reached, set the corresponding |
| 63 |
<literal>may-fail</literal> property to <literal>no</literal>.</para> |
| 64 |
</refsect1> |
| 65 |
|
| 66 |
<refsect1 id='options'><title>Options</title> |
| 67 |
<variablelist> |
| 68 |
<varlistentry> |
| 69 |
<term><group choice='plain'> |
| 70 |
<arg choice='plain'><option>-h</option></arg> |
| 71 |
<arg choice='plain'><option>--help</option></arg> |
| 72 |
</group></term> |
| 73 |
|
| 74 |
<listitem> |
| 75 |
<para>Print help information.</para> |
| 76 |
</listitem> |
| 77 |
</varlistentry> |
| 78 |
|
| 79 |
<varlistentry> |
| 80 |
<term><group choice='plain'> |
| 81 |
<arg choice='plain'><option>-q</option></arg> |
| 82 |
<arg choice='plain'><option>--quiet</option></arg> |
| 83 |
</group></term> |
| 84 |
|
| 85 |
<listitem> |
| 86 |
<para>Don't print anything.</para> |
| 87 |
</listitem> |
| 88 |
</varlistentry> |
| 89 |
|
| 90 |
<varlistentry> |
| 91 |
<term><group choice='plain'> |
| 92 |
<arg choice='plain'><option>-s</option></arg> |
| 93 |
<arg choice='plain'><option>--wait-for-startup</option></arg> |
| 94 |
</group></term> |
| 95 |
|
| 96 |
<listitem> |
| 97 |
<para>Wait for NetworkManager startup to complete, rather than waiting for |
| 98 |
network connectivity specifically. Startup is considered complete once |
| 99 |
NetworkManager has activated (or attempted to activate) every auto-activate |
| 100 |
connection which is available given the current network state. This corresponds |
| 101 |
to the moment when NetworkManager logs <literal>"startup complete"</literal>. |
| 102 |
This mode is generally only useful at boot time. After startup has completed, |
| 103 |
<command>nm-online -s</command> will just return immediately, regardless of the |
| 104 |
current network state.</para> |
| 105 |
<para>There are various ways to affect when startup complete is reached. |
| 106 |
For details see |
| 107 |
<link linkend='NetworkManager-wait-online.service'><citerefentry><refentrytitle>NetworkManager-wait-online.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></link>. |
| 108 |
</para> |
| 109 |
</listitem> |
| 110 |
</varlistentry> |
| 111 |
|
| 112 |
<varlistentry> |
| 113 |
<term> |
| 114 |
<group choice='plain'> |
| 115 |
<arg choice='plain'><option>-t</option></arg> |
| 116 |
<arg choice='plain'><option>--timeout</option></arg> |
| 117 |
</group> |
| 118 |
<arg choice='plain'><replaceable>seconds</replaceable></arg> |
| 119 |
</term> |
| 120 |
|
| 121 |
<listitem> |
| 122 |
<para>Time to wait for a connection, in seconds. If the option is not provided, |
| 123 |
the environment variable <literal>NM_ONLINE_TIMEOUT</literal> is honored. |
| 124 |
The default timeout is 30 seconds.</para> |
| 125 |
</listitem> |
| 126 |
</varlistentry> |
| 127 |
|
| 128 |
|
| 129 |
<varlistentry> |
| 130 |
<term><group choice='plain'> |
| 131 |
<arg choice='plain'><option>-x</option></arg> |
| 132 |
<arg choice='plain'><option>--exit</option></arg> |
| 133 |
</group></term> |
| 134 |
|
| 135 |
<listitem> |
| 136 |
<para>Exit immediately if NetworkManager is not running or connecting.</para> |
| 137 |
</listitem> |
| 138 |
</varlistentry> |
| 139 |
|
| 140 |
</variablelist> |
| 141 |
</refsect1> |
| 142 |
|
| 143 |
<refsect1 id='exit_status'><title>Exit Status</title> |
| 144 |
|
| 145 |
<para><command>nm-online</command> exits with status 0 if it succeeds, a value |
| 146 |
greater than 0 is returned if an error occurs.</para> |
| 147 |
|
| 148 |
<variablelist spacing='compact' termlength='3'> |
| 149 |
<varlistentry> |
| 150 |
<term><errorcode>0</errorcode></term> |
| 151 |
<listitem> |
| 152 |
<para>Success – already online or connection established within given timeout.</para> |
| 153 |
</listitem> |
| 154 |
</varlistentry> |
| 155 |
|
| 156 |
<varlistentry> |
| 157 |
<term><errorcode>1</errorcode></term> |
| 158 |
<listitem> |
| 159 |
<para>Offline or not online within given timeout.</para> |
| 160 |
</listitem> |
| 161 |
</varlistentry> |
| 162 |
|
| 163 |
<varlistentry> |
| 164 |
<term><errorcode>2</errorcode></term> |
| 165 |
<listitem> |
| 166 |
<para>Unknown or unspecified error.</para> |
| 167 |
</listitem> |
| 168 |
</varlistentry> |
| 169 |
|
| 170 |
</variablelist> |
| 171 |
</refsect1> |
| 172 |
|
| 173 |
<refsect1 id='see_also'><title>See Also</title> |
| 174 |
<para><link linkend='nmcli'><citerefentry><refentrytitle>nmcli</refentrytitle><manvolnum>1</manvolnum></citerefentry></link>, |
| 175 |
<link linkend='NetworkManager'><citerefentry><refentrytitle>NetworkManager</refentrytitle><manvolnum>8</manvolnum></citerefentry></link>, |
| 176 |
<link linkend='NetworkManager-wait-online.service'><citerefentry><refentrytitle>NetworkManager-wait-online.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></link>. |
| 177 |
</para> |
| 178 |
</refsect1> |
| 179 |
|
| 180 |
</refentry> |