diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-02-10 14:21:55 +0300 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-02-10 14:21:55 +0300 |
commit | add9056c370442beae9213e5e5a85859f745ee90 (patch) | |
tree | 997685553a76446c719d855f5e3b519625041102 | |
parent | 8897f56e6cd86e193b5f9c826db697e72f20dd7c (diff) |
pkgupdate-watch.sh: show idle and pending states
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rwxr-xr-x | pkgupdate-watch.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pkgupdate-watch.sh b/pkgupdate-watch.sh index a4393b3..6cca0fe 100755 --- a/pkgupdate-watch.sh +++ b/pkgupdate-watch.sh @@ -14,12 +14,20 @@ while true; do sort -nr | sed -ne '1s/^[0-9.]\+ //p')" if [ -d "$log" ]; then - msg="$(tail -n1 "$log/compile.txt")" - if [ ${#msg} -gt 80 ]; then - msg="${msg:0:80}" + d1=$(date +%s) + d2=$(date +%s -r "$log/compile.txt") + + if [ $(($d1 - $d2)) -gt 5 ]; then + log="- idle -" + msg="" + else + msg="$(tail -n1 "$log/compile.txt")" + if [ ${#msg} -gt 80 ]; then + msg="${msg:0:80}" + fi fi else - log="-" + log="- pending -" msg="" fi |