From 79377767577c94bc5bb58c17b6bde60d7f795b68 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sun, 10 Mar 2019 02:48:50 +0000 Subject: [PATCH] bin/nb-update --- bin/nb-update | 3 ++- etc/profile.d/nb.sh | 17 ++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/nb-update b/bin/nb-update index 86da6ec4..fa7abc5b 100755 --- a/bin/nb-update +++ b/bin/nb-update @@ -137,7 +137,8 @@ rm -f /tmp/$NAME.infos /tmp/$NAME.check /run/$NAME-nb_post_sys_infos.lock find /run/$NAME-nb_api_post_sys_infos.lock -mmin +60 -exec rm {} \; >/dev/null 2>&1 if [ ! -e /run/$NAME-nb_api_post_sys_infos.lock ]; then touch /run/$NAME-nb_api_post_sys_infos.lock - nb_api_post_hosts_infos >/dev/null 2>&1 + echo "Post local infos" + nb_api_post_hosts_infos | sed -e 's/^/ /; s/'$'\t''/: /' fi ##################################################################### diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index 0a174f08..94218aa0 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -116,14 +116,13 @@ nb_api_post_host_info() { } nb_api_post_hosts_infos() { - sys_infos | while read -ra i; do - nb_api_post_host_info "sys.${i[0]}" "${i[*]:1}" - done - - which lshw > /dev/null && lshw -quiet -class system \ - | awk '/^ /{sub("^ *","",$0); sub(": ","\t",$0); print $0}' \ - | while read -ra i \ - ; do - nb_api_post_host_info "sys.${i[0]}" "${i[*]:1}" + ( + sys_infos + which lshw > /dev/null && lshw -quiet -class system 2>/dev/null \ + | awk '/^ /{sub("^ *","",$0); sub(": ","\t",$0); print $0}' \ + ; + ) | while read -ra i; do + echo "sys.${i[0]}" "${i[*]:1}" + nb_api_post_host_info "sys.${i[0]}" "${i[*]:1}" > /dev/null done } -- 2.47.3