# This is the script for release the memory cache everyday #
top -b -n 1 | head > /tmp/file1.txt
sleep 10
sync; echo 1 > /proc/sys/vm/drop_caches
sleep 20
top -b -n 1 | head > /tmp/file2.txt
cat /tmp/file1.txt /tmp/file2.txt > /tmp/ram.txt
EMAIL_BODY="
Hello Sysadmin Team,
This is the RAM status after releases:
$(cat /tmp/ram.txt)
Thanks,
DC Team
"
echo "Subject: RAM status for ABC Server" "$EMAIL_BODY" | /opt/zimbra/postfix-2.10.3.2z/sbin/sendmail -t alert@domain.com.
The Above Script will clear the Unused RAM . This will send the email before and after Clearing the RAM.
top -b -n 1 | head > /tmp/file1.txt
sleep 10
sync; echo 1 > /proc/sys/vm/drop_caches
sleep 20
top -b -n 1 | head > /tmp/file2.txt
cat /tmp/file1.txt /tmp/file2.txt > /tmp/ram.txt
EMAIL_BODY="
Hello Sysadmin Team,
This is the RAM status after releases:
$(cat /tmp/ram.txt)
Thanks,
DC Team
"
echo "Subject: RAM status for ABC Server" "$EMAIL_BODY" | /opt/zimbra/postfix-2.10.3.2z/sbin/sendmail -t alert@domain.com.
The Above Script will clear the Unused RAM . This will send the email before and after Clearing the RAM.
Use This script when very Less number of users are using the server.This script will run on Linux Server (RedHat/Centos).The Script can be run during Night Time using Crontab.
Kindly update the Email ID and Sendmail path correctly as per your server.
Comments
Post a Comment