Browse Source

Report tor status as starting if uptime is small

Bob Mottram 6 years ago
parent
commit
1daf58fcd2
1 changed files with 15 additions and 7 deletions
  1. 15
    7
      src/freedombone-tor-health

+ 15
- 7
src/freedombone-tor-health View File

@@ -48,14 +48,22 @@ done < /var/log/tor/notices.log
48 48
 mv /var/log/tor/notices_new.log /var/log/tor/notices.log
49 49
 chown -R debian-tor:adm /var/log/tor
50 50
 
51
-if [ $ctr -gt 5 ]; then
52
-    echo $'Failed'
53
-    exit 0
54
-fi
51
+UPTIME=$(awk -F '.' '{print $1}' < "/proc/uptime")
52
+if [ "$UPTIME" -gt 500 ]; then
53
+    if [ $ctr -gt 5 ]; then
54
+        echo $'Failed'
55
+        exit 0
56
+    fi
55 57
 
56
-if [ $ctr -gt 0 ]; then
57
-    echo $'Poor'
58
-    exit 0
58
+    if [ $ctr -gt 0 ]; then
59
+        echo $'Poor'
60
+        exit 0
61
+    fi
62
+else
63
+    if [ $ctr -gt 0 ]; then
64
+        echo $'Starting'
65
+        exit 0
66
+    fi
59 67
 fi
60 68
 
61 69
 echo $'Good'