We know that the memory cache cleanup command is this:
sync; echo 3 > /proc/sys/vm/drop_caches
But how to make an executable with an if () else () condition, so that this command only runs when memory usage reaches 80% or more through crontab?
Something like this:
#!/bin/sh
if (uso da memoria > 80%){
sync; echo 3 > /proc/sys/vm/drop_caches
}