Quote:
Every time i am getting superb reply from here
|
I didn't understand! What does it mean?
Quote:
I did n't get reply for some more questions from this thread.
Can anyone post your answers .. I am Expecting still
|
1) Did you read 1st reply, in which it is clearly answered for difference between du and df?
2) Why can you not try once?
Code:
man du
man df
df --help
du --help
I think
this may also help you a bit?
3) you can use
find command to check 1/2/3 subdirectories size. For example
Code:
find /home/username/ -maxdepth 2 -type d -exec du -sh {} \;
This will shows 2 more directories size starting from/inside /home/username.
4)
Quote:
It's going to reach 90% very soon. I am planning to enable mobile alert or e-mail alert.
|
This below small script may help you for the above,
Code:
cat check_disk_usage
#!/bin/bash
admin="you@yourdomain.com"
max="90" # To get mail immediately reduce this to 5 or 10 and watch.
df -H | grep -vE '^Filesystem' | awk '{ print $5 " " $1 " " $6 }' | while read output;
do
usage=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
mountpoint=$(echo $output | awk '{ print $3 }' )
if [ $usage -ge $max ]; then
echo "The \"$partition\" partition which is mounted as \"$mountpoint\" has reached \"$usage%\" in $(hostname) PC."| mail -s "Alert on disk usage" $admin
fi
done
Add this to crontab using "
crontab -e" command as a root user. For example add the entry as below in the end of the file.
Code:
01 10 * * * /path/of/check_disk_usage >/dev/null 2>&1
This will run at every morning 10:01 am.
Code:
chmod +x /path/of/check_disk_usage
Hope the above will help you.