From 16871e724fd54ee1551784af0841af94113c510c Mon Sep 17 00:00:00 2001 From: higkoo Date: Mon, 23 Mar 2020 19:49:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0IP=E5=9C=B0=E5=9D=80=E7=9A=84?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在不同操作系统下全路径不一样,比如上述的 ifconfig / route 在 Debian 系统的 /sbin 目录下。 另外 Debian 打印出来 多 'addr:' 需要多处理 /sbin/ifconfig `/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F':' '{print $2}'|head -n 1 还不如直接 hostname -i 获取,正常配置下都Okay的。 --- etc/index.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/index.yml b/etc/index.yml index c65da2e8..2edebbdd 100644 --- a/etc/index.yml +++ b/etc/index.yml @@ -4,4 +4,4 @@ logger: keepHours: 2 identity: specify: "" - shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1 + shell: hostname -i