Send Disk Space Usage Status via email


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Send Disk Space Usage Status via email
# 1  
Old 01-10-2016
Send Disk Space Usage Status via email

Hi Guys,

Is there any way I can write a script that sends DISK SPACE USAGE STATUS via email once a week?

Thanks,
# 2  
Old 01-10-2016
Quote:
Originally Posted by g4v1n
Is there any way I can write a script that sends DISK SPACE USAGE STATUS via email once a week?
Yes, there is.

Sorry, but as long as you do not tell us more about the specifics of your environment and what exactly your problem is (you do not expect us to do your work for you, do you?) we can't help you any better than that.

bakunin
# 3  
Old 01-11-2016
And, very similar problems have been covered umpteen times in these fora, as indicated by the links at the bottom of this page.
# 4  
Old 01-11-2016
You can create a cron job like this
Code:
# crontab -l
1 1 * * 0 df -lk

# 5  
Old 01-13-2016
Thanks Guys, I got it working by installing POSTFIX and MAILUTILS.
I write the following script to find out the disk space and put it into text file and I use php mail function to send it to my email Smilie I
Code:
#!/bin/bash
HB=/home/user/Desktop/heartbeat.txt
df | awk '{print $5}' | sed -ne 2p | cut -d"%" -f1 > $HB

# 6  
Old 01-13-2016
Quote:
Originally Posted by g4v1n
Thanks Guys, I got it working by installing POSTFIX and MAILUTILS.
I write the following script to find out the disk space and put it into text file and I use php mail function to send it to my email Smilie I
Code:
#!/bin/bash
HB=/home/user/Desktop/heartbeat.txt
df | awk '{print $5}' | sed -ne 2p | cut -d"%" -f1 > $HB

Instead of that four stage pipeline, you might try this:
Code:
df|awk -F '[[:space:]%]+' 'NR==2{print $5}' > "$HB"

The NR==2 replaces the sed stage of the pipeline and the more complicated field separator gets rid of the need for the cut stage of the pipeline.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Generate disk space usage email alert

hi all members I have a shell script to generate disk space usage email alert if threshold is more than 80 %, now the requirement changed to keep sending alert emails for every 5% incremental usage ........ Any help would be greatly appreciated. ex - 80% , 85% ,90%,95%,100% we should get an... (6 Replies)
Discussion started by: anil529
6 Replies

2. Shell Programming and Scripting

Help....script check status if see something then send email

autorep -m bogus Machine Name Max Load Current Load Factor O/S Status ___________ ________ ___________ ______ ________ ______ bogus --- --- 1.00 Sys Agent Online Status ______ Online Offline Missing Unqualified The "Status" always "Online". I like create a script execute run... (6 Replies)
Discussion started by: dotran
6 Replies

3. UNIX Desktop Questions & Answers

Issue with disk space usage

Issue with disk space usage I have the following line in my "df -h" output: Filesystem Size Used Avail Capacity Mounted on /dev/ad4s1a 496M 495M -39M 109% / What is the issue with having 9% excess utilisation? How can I find out what this partition is... (2 Replies)
Discussion started by: figaro
2 Replies

4. Shell Programming and Scripting

Disk Usage - Space Used

Hi all, FreeBSD7.1 @ sh. In a backup script I am trying to get the blocks used by the backup once completed. I am using the function: #!/bin/sh spaceused() { du -d 0 "${1}" | awk -F"+" '{ print $1 } } to return the blocks used of said directory and contents. Via. command line... (7 Replies)
Discussion started by: Festus Hagen
7 Replies

5. 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

6. Shell Programming and Scripting

shell script to send email with usage of space in the directory as description :

shell script to send email with usage of space in the directory as description : Please any one help me in writing a script to send email with usage of space in the directory as description . (3 Replies)
Discussion started by: sakthifire
3 Replies

7. Shell Programming and Scripting

Need to send email on HIGH Disk usage

Hi Guys I am looking for a python / PERL script which will send me email when ever my disk becomes more than 90% full. By the way my OS is Win XP. If anybody have already has written same type of script or something very similar kind of script, that will also be very helpful. Thanks... (1 Reply)
Discussion started by: csaha
1 Replies

8. UNIX for Dummies Questions & Answers

how to determine the disk space usage

how can we determine the disk space used by a certain directory? (1 Reply)
Discussion started by: gfhgfnhhn
1 Replies

9. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies

10. UNIX for Dummies Questions & Answers

awk to find the status and send an email

Hi, I have a datafile which has the following data and it can have much more records. The data set is as follows: ISA~00~ ~00~ ~ZZ~F159B ~ZZ~U1CAD ~051215~184 3~U~00200~000011432~0~P~< GS~FA~TC11A~U1CAD~051215~1843~000011432~X~002002 ST~997~0001... (6 Replies)
Discussion started by: isingh786
6 Replies
Login or Register to Ask a Question