日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

linux shell 获取本机ip 写入文件

發(fā)布時間:2023/11/30 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux shell 获取本机ip 写入文件 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

本機IP獲取

/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"


k8s 獲取容器所造node節(jié)點的ip

container_net=`ifconfig eth0 |grep "inet" |grep -v "inet6"| awk '{print $2}'|cut -d '.' -f 3`node_ip=`etcdctl --endpoints=https://10.0.13.78:2379,https://10.0.13.80:2379,https://10.0.13.81:2379 --cert-file=/home/yanfa/cert/etcd.pem --key-file=/home/yanfa/cert/etcd-key.pem --ca-file=/home/yanfa/cert/etcd-root-ca.pem get /kube-centos/network/subnets/10.252.${container_net}.0-24 |sed 's/.*"PublicIP":"\([^"]\+\)".*/\1/' `

寫入過程 displayip.sh

?

hostnet=$(/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:") echo $hostnet >>ipdns.txt ~ ~

?chmod 755 displayip.sh
運行:./displayip.sh??

總結(jié)

以上是生活随笔為你收集整理的linux shell 获取本机ip 写入文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。