... | ... |
@@ -25,6 +25,25 @@ function core_alim () { |
25 | 25 |
test $volt_fmt -lt 12000 -o $volt_fmt -gt 15000 && echo "$volt" |
26 | 26 |
} |
27 | 27 |
|
28 |
+function clean_swap () { |
|
29 |
+ _turn 2 || return |
|
30 |
+ if free -m | awk ' |
|
31 |
+ /^Swap:/ { |
|
32 |
+ used = $3 |
|
33 |
+ } |
|
34 |
+ END { |
|
35 |
+ exit (used > 31) |
|
36 |
+ } |
|
37 |
+ '; then |
|
38 |
+ echo 1 > /proc/sys/vm/drop_caches |
|
39 |
+ systemctl stop dphys-swapfile \ |
|
40 |
+ && systemctl stop zram \ |
|
41 |
+ && systemctl start zram \ |
|
42 |
+ && systemctl start dphys-swapfile \ |
|
43 |
+ || echo 'erreur' |
|
44 |
+ fi |
|
45 |
+} |
|
46 |
+ |
|
28 | 47 |
function mem_pressure () { |
29 | 48 |
local meminfo=($(</proc/meminfo)) |
30 | 49 |
local level=(danger severe warning) |