#!/bin/bash
THRESHOLD=40
CACHED_KB=$(awk '/^Cached:/ {print $2}' /proc/meminfo)
CACHED_GB=$(echo "scale=0; $CACHED_KB / 1024 / 1024" | bc)
IS_OVER=$(echo "$CACHED_GB > $THRESHOLD" | bc)
#echo $IS_OVER
#echo $CACHED_KB
#echo $CACHED_GB
echo "Önbellek boyutu ($CACHED_GB GB)"
if [ "$IS_OVER" -eq 1 ]; then
echo "The cache has exceeded the 40 GB limit. ($CACHED_GB GB). Flushing..."
sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'
else
echo "The cache limit is not exceeded. ($CACHED_GB GB)."
fi
a bash script for cron
and I did a user.slice configuration
[Slice]
CPUQuota=90%
Everything is fine now.