Showing posts from November, 2016

Script for release the RAM cache everyday

# 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

Hello Sysadmin Team,

This is the RAM status after releases:
$(cat /tmp/ram.txt)
DC Team

echo "Subject: RAM status for ABC Server" "$EMAIL_BODY" | /opt/zimbra/postfix- -t

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.

The Script for Temperature Alert using email from the Linux Server (If it Cross 40 c)

#! /bin/bash
TEMP=$(sensors | grep "id 0" | cut -d + -f2 | cut -d . -f1)
if [ "$TEMP" -ge 40 ]; then
echo $TEMP
date > /tmp/temp
sensors >> /tmp/temp
Hello Helpdesk Team,
This is the Temperature Alert Message forABC Server at DC Location,CITY:
$(cat /tmp/temp)
Datacenter TEAM
echo "Subject: ALERT High Temperature for Server at DC Location " "$TEMP_BODY" | /opt/postfix- -t

In this Script Replace the with Correct Email id and Sendmail path with correct Send-mail path. In this script we are monitoring the CPU Temperature. This Script will work on Linux Server (Red Hat/Centos )