Showing 1 changed files with 3 additions and 6 deletions
+3 -6
monitoring.d/raspberrypi
... ...
@@ -87,18 +87,15 @@ function core_alim () {
87 87
 
88 88
 function clean_swap () {
89 89
     _turn 2 || return
90
-    if free -m | awk '
91
-        /^Mem:/ {
92
-            free = $4
93
-        }
90
+    echo 1 > /proc/sys/vm/drop_caches
91
+    if LANG=C free -m | awk '
94 92
         /^Swap:/ {
95 93
             used = $3
96 94
         }
97 95
         END {
98
-            exit (used > 31 && free - used > 0)
96
+            exit (used > 62)
99 97
         }
100 98
     '; then
101
-        echo 1 > /proc/sys/vm/drop_caches
102 99
         systemctl stop dphys-swapfile \
103 100
         && systemctl stop zram        \
104 101
         && systemctl start zram       \