Send information about disk occupation periodically by email


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Send information about disk occupation periodically by email
# 1  
Send information about disk occupation periodically by email

Hi,

I want to make a shell script that gives me the information about the disk occupation by sending me an email once in a month for example.

With this command df|tr -s " "|cut -d" " -f 1,5 I can see the occupation but I dont know how to make the machine to send me the email with this information.

Can someone help me please?
# 2  
How about:
Code:
df | tr -s " " | cut -d" " -f 1,5 | mailx -s "Disk Utilization" user@domain.com

# 3  
I tried to execute that command on the command line but it gives me the message:

Code:
Null message body; hope that's ok
/tmp/RshwFuxE: No space left on device

I haven't received any email.

Last edited by Scott; 12-12-2012 at 12:22 PM.. Reason: Code tags
# 4  
Try to execute the simpler command

With thanks to... bipinajith
try to simply do the command without the mail component

Code:
df | tr -s " " | cut -d" " -f 1,5

# 5  
That part of the command is ok, it gives me the information about the disks. But then I want to send that information by email. How do I do that?
# 6  
Where is your mail stored?
What is on the drive that it says is full?

If that mailx command is giving an error, it is trying to access that drive to do something. Can you free up some space on that disk drive?
# 7  
I have free some space:

Code:
[root/]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              48G   35G   11G  77% /
/dev/sda7             439G   27G  390G   7% /database
/dev/sda6             4.8G  214M  4.3G   5% /var/log
/dev/sda5             9.5G  151M  8.9G   2% /captures
/dev/sda3             142G   20G  116G  15% /backup
tmpfs                 5.9G  257M  5.7G   5% /dev/shm

I tried to execute the command :
Code:
echo "this is a test" | mail -s "disk space" asd@domain.com

But I still dont receive any email.

What do you mean when you ask where I have the mail stored?

Last edited by Franklin52; 12-13-2012 at 05:04 AM.. Reason: Please use code tags for data and code samples
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #145
Difficulty: Easy
Unix popularized the hierarchical file system with arbitrarily nested subdirectories, originally introduced by Multics.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Information on forwarding queue occupation in a Linux router

Hello. I have an OpenWrt router forwarding traffic from a network to another and I'm building a monitoring tool that requires information about the packet queue/ ring buffer (in the receiving side/interface - rx) occupation, alerting me when it is close to its maximum capacity. However, after... (1 Reply)
Discussion started by: i_mll
1 Replies

2. Shell Programming and Scripting

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, (5 Replies)
Discussion started by: g4v1n
5 Replies

3. SuSE

Send outgoing email to my GroupWise email

Dear users, I have Linux server whose versions are Suse 10 SP 3 and Suse 11. I am trying to send email from these servers to my GroupWise email account. In /etc/postfix/main.cf file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Discussion started by: JDBA
0 Replies

4. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

5. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

6. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

7. Shell Programming and Scripting

script to send command periodically to remote server

Hi, I'm wondering if there's a way to send a command periodically to remote server through a script. Right now I have this: keepLooping=1 ssh user@domain while (( keepLooping == 1 )) do echo a sleep 3 done but what this does is ssh to the server, and only when the connection is... (2 Replies)
Discussion started by: sayeo
2 Replies

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

9. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

Featured Tech Videos