Re: Grabbing connection and link status with nmcli



On Wed, 2017-08-30 at 17:17 +0100, colin helliwell ln-systems com
wrote:
I've not used nmcli in any of its more intricate ways, but are there
some
easily-parsed commands which will allow me to tell whether an
Ethernet
interface is up (a la 'nmcli conn up/down') AND the cable is
connected
('link/carrier state')?
I can grab some hints of the latter with /sys/class/net/eth0/carrier,
but
would prefer an approach that is harmonised through nmcli. Are there
a
couple of sub-commands that can be used rather than parsing the full
'nmcli
dev show' output? e.g. to output a couple of specific fields.


Hi,

how about:

LANG=C nmcli -t -m tabular -f WIRED-PROPERTIES.CARRIER device show "$DEV"


Thomas

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]