From: Nicolas Boisselier Date: Tue, 10 Apr 2018 21:17:41 +0000 (+0100) Subject: etc/profile.d/sys.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=39006cc51bdf6d41bd44dc8c6370ed439b925ba8;p=nb.git etc/profile.d/sys.sh --- diff --git a/bin/nb-update b/bin/nb-update index 6ab5e4c1..736bf46a 100755 --- a/bin/nb-update +++ b/bin/nb-update @@ -2,7 +2,7 @@ ##################################################################### # # Pull update and run install script -# Called by cron/etc/nb +# Called by cron # ##################################################################### NAME="$(basename "${0}")" @@ -11,6 +11,27 @@ CLEANUP=0 [ "$1" = "-cleanup" ] && CLEANUP=1 ##################################################################### +# +# Functions +# +##################################################################### +run_parts_minutes() { + local usage="run_parts_minutes MINUTES DIR" \ + local min=${1:?$usage}; min=$(($min-1)) + local dir=${2:?$usage} + local lock="/run/run_parts_minutes.$min" + #echo $min $dir + find "$lock" -mmin +$min -exec rm {} \; >/dev/null 2>&1 + [ -e "$lock" ] && return + #touch "$lock" || return + run-parts -v --test --report "$dir" + echo BYE +} +if [ "$1" = "-test" ]; then + run_parts_minutes 1 /tmp/run/ + exit 0 +fi + # # Requirments # @@ -37,7 +58,6 @@ for repo in $(nb_repos); do # name from git not from path name=$(git_name) || continue [ -z "$name" ] && continue - #name="$(basename $repo)" # args filter on name @@ -117,10 +137,10 @@ done ##################################################################### # Update infos # -rm -f /tmp/$NAME.infos -find /tmp/$NAME.check -mmin +60 -exec rm {} \; > /dev/null 2>&1 -if [ ! -e /tmp/$NAME.check ]; then - touch /tmp/$NAME.check +rm -f /tmp/$NAME.infos /tmp/$NAME.check +find /run/$NAME-nb_post_sys_infos.lock -mmin +60 -exec rm {} \; >/dev/null 2>&1 +if [ ! -e /run/$NAME-nb_post_sys_infos.lock ]; then + touch /run/$NAME-nb_post_sys_infos.lock nb_post_sys_infos fi diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 0c17f05c..8ab6d518 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -223,8 +223,10 @@ env_add_path() { case "${env_value}" in *:$p|*:$p:*|$p:*|$p) continue;; esac - [ -z "$env_value" ] || env_value=":${env_value}" - env_value="${p}${env_value}" +# NB 10.04.18 [ -z "$env_value" ] || env_value=":${env_value}" +# NB 10.04.18 env_value="${p}${env_value}" + [ -z "$env_value" ] || env_value="${env_value}:" + env_value="${env_value}${p}" done # Clean up doubles diff --git a/etc/profile.d/sys.sh b/etc/profile.d/sys.sh index 881d2b48..1c101c4e 100644 --- a/etc/profile.d/sys.sh +++ b/etc/profile.d/sys.sh @@ -10,7 +10,7 @@ arch${s}$(sys_arch) nproc${s}$(sys_nproc) date_install${s}$(sys_date_install) ips${s}$(echo -n $(ips 2>/dev/null)) -ippublic${s}$( (http_get http://nbdom.net/myip || curl -s http://nbdom.net/myip) 2>/dev/null) +public_ip${s}$( (http_get http://nbdom.net/myip || curl -s http://nbdom.net/myip) 2>/dev/null) EOF }