... | ... |
@@ -85,6 +85,27 @@ function core_alim () { |
85 | 85 |
test $volt_fmt -lt 12000 -o $volt_fmt -gt 15000 && echo "$volt" |
86 | 86 |
} |
87 | 87 |
|
88 |
+function clean_swap () { |
|
89 |
+ _turn 2 || return |
|
90 |
+ if free -m | awk ' |
|
91 |
+ /^Mem:/ { |
|
92 |
+ free = $4 |
|
93 |
+ } |
|
94 |
+ /^Swap:/ { |
|
95 |
+ used = $3 |
|
96 |
+ } |
|
97 |
+ END { |
|
98 |
+ exit !(used > 31 && free - used > 0) |
|
99 |
+ } |
|
100 |
+ '; then |
|
101 |
+ systemctl stop dphys-swapfile \ |
|
102 |
+ && systemctl stop zram \ |
|
103 |
+ && systemctl start zram \ |
|
104 |
+ && systemctl start dphys-swapfile \ |
|
105 |
+ || echo 'erreur' |
|
106 |
+ fi |
|
107 |
+} |
|
108 |
+ |
|
88 | 109 |
function mem_pressure () { |
89 | 110 |
local meminfo=($(</proc/meminfo)) |
90 | 111 |
local level=(danger severe warning) |