Script to check disk space
by Ameya on May.28, 2009, under Uncategorized
Schedule this script with your crontab and keep an eye on your disk space filling up. You can set which partitions to monitor, whom to email for notifications and when should you receive email.
#!/bin/bash
# Shell script to monitor or watch the low-disk space
# It will send an email to $ADMIN, if the (free avilable) percentage
# of space is >= 90%
# ——————————————————————————————————————————————————————————————————————————————————
# Linux shell script to watch disk space
# Mention the disk path which you would like to monitor.
# set admin email where you would like to receive notifications.
# set alert level. 90% is default.
PATHS=”/ /home”
MAILFILE=”/tmp/mailviews”
LEVEL=”90″
ADMIN=”root”
for pth in $PATHS
do
DISK_AVAIL=`df $pth | grep -v “Filesystem” | awk ‘{print $5}’| sed ’s/%//g’`
if [ $DISK_AVAIL -gt $LEVEL ];then
echo “Your $pth is filled upto $DISK_AVAIL%” > $MAILFILE
echo “Please cleanup your harddisk.” >> $MAILFILE
cat $MAILFILE | mail -s “WARNING: Disk Full!” $ADMIN
rm $MAILFILE
fi
done
I am back!
by Ameya on Apr.27, 2009, under Uncategorized
The first day of week. Start of the day is nice. It took me just a few minutes to install my blog. Since last few years my domain was hosted with dreamhost and they blocked the account with which my domain was hosted due to some viloation of policies. They never cleared what was that. The account belonged to my friend and past colleague Naveen. He helped me out the get the backup of my domain. I was quite busy with work when dreamhost provided the backup and I just downloaded the wrong DB backup. Which mean I have lost all the efforts, post, and everything.
Anyway, Its a new day and a new start.
Cheers,
Ameya