DISK SPACE in UNIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting DISK SPACE in UNIX
# 1  
Old 05-05-2012
DISK SPACE in UNIX

Hi,

I have to regularly monitor manually if my diskspace is close to 90% or not. I use to see this by firing df -k. I want to write a script which can run 24*7 hours and would me mail me whenever the disk space is 90% or more..It would be really great if someone can helo me on this.
# 2  
Old 05-05-2012
A primitive script. This will check if total disk space used is >= 90% once in every 10s and if so, an email will be sent. It'll run in an infinite loop until you kill it.

Code:
#! /bin/bash

while [ 1 ]
do
    total=$(df -k --total | awk 'END{sub (/%$/,"",$5); print $5}')
    if [ $total -ge 90 ]
        echo "Message" | mailx -s "Alert Subject" user@email.com
    fi
    sleep 10
done

This User Gave Thanks to balajesuri For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

disk space

when i check /export directory of my machine gets filled up (85%) i removed some old logs. but after cleaning df -k command still shows that /export is still 85% full. Is there a way to force df to reflect actual free space without rebooting? My machine is a production one and can't... (8 Replies)
Discussion started by: aboorkuma
8 Replies

2. Filesystems, Disks and Memory

disk space

Hello All- Am new member to this forum. Have some unix experience. But true believer in it compared to windows. Have a question regarding the disk space. I know a command to check the total disk space utilization using: df -k . but what is the command to check the same disk space by... (6 Replies)
Discussion started by: milkyway
6 Replies

3. Filesystems, Disks and Memory

Disk space and RAM status in UNIX

I have an application which is running under AIX, HP UNIX, SCO, and LINUX(redhat and SuSE). and its dealing with some bulk amount of file handling, and some of my boxes are not very good in terms of resources like memory and disk space. so i wanted to know the statistics of each of my boxes. Like... (2 Replies)
Discussion started by: renjithram
2 Replies

4. Shell Programming and Scripting

Disk space details from Unix to Outlook

Hi Friends, I am using sun Solaris . I want to find the disk space (df -k) for the Unix box and the data has to be sent to an email id. Can u please find me a code that checks the disk space 6 times a day, loads the data into an excel sheet and sends to an email id. Can u also tell me how to... (2 Replies)
Discussion started by: sridharnr
2 Replies

5. HP-UX

Disk Space

Hi Experts. I had 100% disk full , even though i have removed 2 GB space still dbf command shows 100%. How to rectify that. Appreciate your prompt help. Thanks (1 Reply)
Discussion started by: test10002
1 Replies

6. Filesystems, Disks and Memory

disk space

Hi experts i am new in unix and informix and would like to ask 2 questions 1) my server shows when using df -k fs 1024-block used available /usr 10079072 3668670 6381144 does this mean i have 10GB, and used up 3.7GB and available 6.3GB ??? is... (3 Replies)
Discussion started by: kingsto88
3 Replies

7. UNIX for Dummies Questions & Answers

SCO Unix - Disk Space

Hi, I am using SCO Unix 3.12 and Informix database. When we tried to use "du -a" command to check disk space, it showed: 342122 ./usr 30092 ./etc 6244 ./dev 4778 ./bin 2674 ./tcb 1234 ./lost+found 698 ./lib 532 ./shlib 46 ./tmp 6 ./messages 4 ./opt 4 ./var 2 ./mnt 2 ./install... (1 Reply)
Discussion started by: trinhnguyen
1 Replies

8. Solaris

Disk space?

I'm a Unix newbie running Solaris 9. After installing a fresh copy on a 40GB drive I noticed the available disk space is 2% free or approximately 200MB available. Is that possible? Did I do something wrong? (4 Replies)
Discussion started by: jbarbuto
4 Replies

9. UNIX for Dummies Questions & Answers

available disk space on disk device???

Hello, Can someone please tell me which command to use to determine the available disk space on a given disk device? I have to write a shell script that compresses files and stores them in a specific location but I am not sure how "conservative" I should be? Thanks in advance! Al. (4 Replies)
Discussion started by: alan
4 Replies
Login or Register to Ask a Question