gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r26713 - gnunet-planetlab/gplmt/contrib


From: gnunet
Subject: [GNUnet-SVN] r26713 - gnunet-planetlab/gplmt/contrib
Date: Mon, 1 Apr 2013 23:23:17 +0200

Author: otarabai
Date: 2013-04-01 23:23:17 +0200 (Mon, 01 Apr 2013)
New Revision: 26713

Modified:
   gnunet-planetlab/gplmt/contrib/stat-cached.sh
Log:
modified statistics caching script



Modified: gnunet-planetlab/gplmt/contrib/stat-cached.sh
===================================================================
--- gnunet-planetlab/gplmt/contrib/stat-cached.sh       2013-04-01 19:03:03 UTC 
(rev 26712)
+++ gnunet-planetlab/gplmt/contrib/stat-cached.sh       2013-04-01 21:23:17 UTC 
(rev 26713)
@@ -4,14 +4,19 @@
 expiration_time=120
 
 if [ -f "$file" ]; then
-       current=`date +%s`
-       modified=`stat -c "%Y" $file`
-       if [ $(($current-$modified)) -gt $expiration_time ]; then
-               gnunet-statistics > $file
-       fi
+        current=`date +%s`
+        modified=`stat -c "%Y" $file`
+        if [ $(($current-$modified)) -gt $expiration_time ]; then
+                gnunet-statistics > $file
+        fi
 else
-       gnunet-statistics > $file
+        gnunet-statistics > $file
 fi
 
 # parse file here
-grep "$1 .* $2" $file | awk '{print $NF}'
+val=$(grep "$1 .* $2" $file | awk '{print $NF}')
+if [ -z "$val" ]; then
+        echo "0"
+else
+        echo $val
+fi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]