From b6c2c572adfd1d7120e0b6dff58053acf9ad6d98 Mon Sep 17 00:00:00 2001 From: q Date: Fri, 26 Feb 2016 20:06:05 +0200 Subject: [PATCH] background update --- rc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rc b/rc index cb1da57..b999c1d 100755 --- a/rc +++ b/rc @@ -13,13 +13,14 @@ export PATH function _self_update() { touch "$TOOLSPATH"/.lastupdate pushd "$TOOLSPATH" > /dev/null - timeout 5 hg pull -u > /dev/null 2>&1 + timeout 5 hg pull -u > /dev/null 2>&1 & popd > /dev/null } [[ "$1" = "-u" ]] && _self_update # Update self weekly +[[ -w "$TOOLSPATH" ]] || return [[ -t 0 ]] || return [[ -t 1 ]] || return [[ -t 2 ]] || return @@ -27,6 +28,6 @@ function _self_update() { [[ -w "$TOOLSPATH"/.lastupdate ]] || return TOOLS_LASTUPDATE=$(( $( date +%s ) - $( stat -c %Y "$TOOLSPATH"/.lastupdate ) )) -[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update +[[ "$TOOLS_LASTUPDATE" -gt 604800 ]] && _self_update unset TOOLS_LASTUPDATE unset -f _self_update