Results 1 to 3 of 3
When my question gets asked it will be obvious that I'm new to Linux.
I'm writing a couple of simple bash scripts that monitor the size of a directory for ...
- 04-27-2010 #1Just Joined!
- Join Date
- Jan 2010
- Location
- Houston
- Posts
- 8
Scripting
When my question gets asked it will be obvious that I'm new to Linux.
I'm writing a couple of simple bash scripts that monitor the size of a directory for me on my production server.
du -h /dir1/dir2 >> results.txt
Right now I have the output redirecting to a file on the server. I have seen that I can redirect the output to an email address, but can't put the pieces together. In the window$ world I could simply install the SMTP server and point it to my current email environment. Not sure if it’s the same in Linux or not.
Could someone point me in the right direction on which files to edit to get the output send to an email address in my corporate mail environment?
I'm not looking to setup a full mail server, just want to send mail to my mail server.
Also, is there a best practice for storing script files that are used for monitoring and backup? I am not familiar enough with the structure to know if should save the scripts in /bin or /sbin or just create a directory called /scripts and save them all there.
Thanks for your time and help with this.
- 04-27-2010 #2
For sending mail on the command line, you need two things
- a locally installed mta like sendmail/postfix/qmail/etc with a very basic config, as you just want to send mail and only inside your intranet
- the mail command
This URL provides some examples
How to send email from the Linux command line – Simple Help
Where to place own scripts:
According to Filesystem Hierarchy Standard they belong here:
- /usr/local/bin for non-root scripts
- and /usr/local/sbin for root scripts
One question:
Are you interested in the size of specific directories
or rather if the partition they are on get full?
Actually, in both cases a monitoring solution like Munin - Trac
example output: Munin :: ping.uio.no :: knuth.ping.uio.no
or green : Xymon - Status @ Tue Apr 27 22:20:56 2010 might be more suitable, as they also show trends.
For a start, you might go with munin. It´s easier to setup
You must always face the curtain with a bow.
- 04-28-2010 #3Just Joined!
- Join Date
- Jan 2010
- Location
- Houston
- Posts
- 8
Thanks for the help. This lead me to my answers.


Reply With Quote