From edc402a71fe35144653792e53f28015bdf3874d6 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Tue, 18 Apr 2023 02:43:02 +0200 Subject: [PATCH] bin/nb-update --- bin/nb-update | 8 ++++++-- etc/profile.d/nb.sh | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/nb-update b/bin/nb-update index a048797b..4ecf53d9 100755 --- a/bin/nb-update +++ b/bin/nb-update @@ -146,10 +146,14 @@ done # rm -f /tmp/$NAME.infos /tmp/$NAME.check /run/$NAME-nb_post_sys_infos.lock find /run/$NAME-nb_api_post_hosts_infos.lock -mmin +$((60*4)) -exec rm {} \; >/dev/null 2>&1 -if [ ! -e /run/$NAME-nb_api_post_hosts_infos.lock ]; then + +if [ ! -e /run/$NAME-nb_api_post_hosts_infos.lock ] +then touch /run/$NAME-nb_api_post_hosts_infos.lock + echo ">Post sys infos" - nb_api_post_hosts_infos | sed -e 's/^/ /; s/'$'\t''/: /' + nb_api_post_hosts_infos | tee /run/nb-sys.csv.tmp | sed -e 's/^/ /; s/'$'\t''/: /' + [ -e /run/nb-sys.csv.tmp ] && sed -e 's/^sys\.//' /run/nb-sys.csv.tmp > /run/nb-sys.csv echo fi diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index efe540cd..97515c9b 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -136,7 +136,9 @@ nb_api_post_hosts_infos() { # NB 11.04.23 ; ) | while read -ra i; do - echo "sys.${i[0]}" "${i[*]:1}" + + echo "sys.${i[0]}"$'\t'"${i[*]:1}" + [ "$1" != "-test" ] && nb_api_post_host_info "sys.${i[0]}" "${i[*]:1}" > /dev/null done } -- 2.47.3