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?

How about:

df | tr -s " " | cut -d" " -f 1,5 | mailx -s "Disk Utilization" user@domain.com

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

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

I haven't received any email.

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

df | tr -s " " | cut -d" " -f 1,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?

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?

I have free some space:

[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 :

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?

Try using sendmail instead:-

{
 echo "To: asd@domain.com"
 echo "Content-Type: text/plain"
 echo "Subject: Test Mail"
 echo "This is a test"
} | sendmail -t

If you still do not receive a mail, run mail and check the server mail box for any mail delivery failure notification.