2016-04-04 18:05:49 +02:00
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
2024-03-22 14:25:00 +00:00
< !DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
2016-04-04 19:22:45 +02:00
<!ENTITY % entities SYSTEM "common.ent" >
%entities;
]>
2016-04-04 18:05:49 +02:00
<!--
2023-10-03 11:05:36 +02:00
SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2016-04-04 18:05:49 +02:00
nm-online(1) manual page
Copyright 2010 - 2016 Red Hat, Inc.
-->
<refentry id= 'nm-online' >
<refentryinfo >
<title > nm-online</title>
<author > NetworkManager developers</author>
</refentryinfo>
<refmeta >
<refentrytitle > nm-online</refentrytitle>
<manvolnum > 1</manvolnum>
<refmiscinfo class= "source" > NetworkManager</refmiscinfo>
<refmiscinfo class= "manual" > General Commands Manual</refmiscinfo>
2016-04-04 19:22:45 +02:00
<refmiscinfo class= "version" > &NM_VERSION; </refmiscinfo>
2016-04-04 18:05:49 +02:00
</refmeta>
<refnamediv >
<refname > nm-online</refname>
<refpurpose > ask NetworkManager whether the network is connected</refpurpose>
</refnamediv>
<refsynopsisdiv id= 'synopsis' >
<cmdsynopsis >
<command > nm-online</command>
<arg choice= "opt" rep= "repeat" > <replaceable > OPTIONS</replaceable> </arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id= 'description' > <title > Description</title>
<para > <command > nm-online</command> is a utility to find out whether we are
online. It is done by asking NetworkManager about its status. When run,
<command > nm-online</command> 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).</para>
2020-03-17 12:31:02 +01:00
<para > This tool is not very useful to call directly. It is however used by
<literal > NetworkManager-wait-online.service</literal> with
2022-03-02 11:05:45 +01:00
<literal > --wait-for-startup</literal> argument
(see <link linkend= 'NetworkManager-wait-online.service' > <citerefentry > <refentrytitle > NetworkManager-wait-online.service</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </link> ).
2020-03-17 12:31:02 +01:00
</para>
2020-04-23 17:24:22 +02:00
<para > By default, connections have the <literal > ipv4.may-fail</literal> and
<literal > ipv6.may-fail</literal> properties set to <literal > yes</literal> ;
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
<literal > network-online.target</literal> is reached, set the corresponding
<literal > may-fail</literal> property to <literal > no</literal> .</para>
2016-04-04 18:05:49 +02:00
</refsect1>
<refsect1 id= 'options' > <title > Options</title>
<variablelist >
<varlistentry >
<term > <group choice= 'plain' >
2018-10-31 13:47:02 +01:00
<arg choice= 'plain' > <option > -h</option> </arg>
<arg choice= 'plain' > <option > --help</option> </arg>
2016-04-04 18:05:49 +02:00
</group> </term>
<listitem >
2018-10-31 13:47:02 +01:00
<para > Print help information.</para>
2016-04-04 18:05:49 +02:00
</listitem>
</varlistentry>
<varlistentry >
<term > <group choice= 'plain' >
<arg choice= 'plain' > <option > -q</option> </arg>
<arg choice= 'plain' > <option > --quiet</option> </arg>
</group> </term>
<listitem >
<para > Don't print anything.</para>
</listitem>
</varlistentry>
<varlistentry >
<term > <group choice= 'plain' >
<arg choice= 'plain' > <option > -s</option> </arg>
<arg choice= 'plain' > <option > --wait-for-startup</option> </arg>
</group> </term>
<listitem >
<para > 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
2020-03-17 12:31:02 +01:00
connection which is available given the current network state. This corresponds
to the moment when NetworkManager logs <literal > "startup complete"</literal> .
This mode is generally only useful at boot time. After startup has completed,
2016-04-04 18:05:49 +02:00
<command > nm-online -s</command> will just return immediately, regardless of the
2020-03-17 12:31:02 +01:00
current network state.</para>
<para > There are various ways to affect when startup complete is reached.
2022-03-02 11:05:45 +01:00
For details see
<link linkend= 'NetworkManager-wait-online.service' > <citerefentry > <refentrytitle > NetworkManager-wait-online.service</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </link> .
2020-03-17 12:31:02 +01:00
</para>
2016-04-04 18:05:49 +02:00
</listitem>
</varlistentry>
2018-10-31 13:47:02 +01:00
<varlistentry >
<term >
<group choice= 'plain' >
<arg choice= 'plain' > <option > -t</option> </arg>
<arg choice= 'plain' > <option > --timeout</option> </arg>
</group>
<arg choice= 'plain' > <replaceable > seconds</replaceable> </arg>
</term>
<listitem >
<para > Time to wait for a connection, in seconds. If the option is not provided,
2020-04-28 22:12:21 +02:00
the environment variable <literal > NM_ONLINE_TIMEOUT</literal> is honored.
The default timeout is 30 seconds.</para>
2018-10-31 13:47:02 +01:00
</listitem>
</varlistentry>
<varlistentry >
<term > <group choice= 'plain' >
<arg choice= 'plain' > <option > -x</option> </arg>
<arg choice= 'plain' > <option > --exit</option> </arg>
</group> </term>
<listitem >
<para > Exit immediately if NetworkManager is not running or connecting.</para>
</listitem>
</varlistentry>
2016-04-04 18:05:49 +02:00
</variablelist>
</refsect1>
<refsect1 id= 'exit_status' > <title > Exit Status</title>
<para > <command > nm-online</command> exits with status 0 if it succeeds, a value
greater than 0 is returned if an error occurs.</para>
<variablelist spacing= 'compact' termlength= '3' >
<varlistentry >
<term > <errorcode > 0</errorcode> </term>
<listitem >
<para > Success – already online or connection established within given timeout.</para>
</listitem>
</varlistentry>
<varlistentry >
<term > <errorcode > 1</errorcode> </term>
<listitem >
<para > Offline or not online within given timeout.</para>
</listitem>
</varlistentry>
<varlistentry >
<term > <errorcode > 2</errorcode> </term>
<listitem >
<para > Unknown or unspecified error.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id= 'see_also' > <title > See Also</title>
2016-05-30 20:24:32 +02:00
<para > <link linkend= 'nmcli' > <citerefentry > <refentrytitle > nmcli</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> </link> ,
2022-03-02 11:05:45 +01:00
<link linkend= 'NetworkManager' > <citerefentry > <refentrytitle > NetworkManager</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </link> ,
<link linkend= 'NetworkManager-wait-online.service' > <citerefentry > <refentrytitle > NetworkManager-wait-online.service</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </link> .
</para>
2016-04-04 18:05:49 +02:00
</refsect1>
</refentry>