Page 1 of 1

send mail through shell script

Posted: Sun Jan 28, 2007 12:15 pm
by satisht
Hi all,

I have to monitor disk space for the datastage projects on development and production on unix servers daily, I am generally using the commands to monitor disk space, but just to make the job easier I am just thinking of a shell script that would automatically generate a mail to me every 3 or 4 hours.
that how much disk space has been used?

Can anyone of you please suggest a shell script?


Thanks in advance

Posted: Sun Jan 28, 2007 12:47 pm
by narasimha
You can write a script to find the free space using

Code: Select all

df -k . | grep -v used | awk '{ print $2 " " $3 "      " $4 "          " $5 }'
Send a mail with mailx
You can schedule your script using cron or other scheduling tools, every 3 or 4 hours or whatever frequency you want.

Re: send mail through shell script

Posted: Sun Jan 28, 2007 1:52 pm
by DSguru2B
satisht wrote:
Can anyone of you please suggest a shell script?
There is no pre-written shell script per se. But you can build your own as narasimha advised. A shell is nothing but unix commands bundled up on a file. Read about mailx, coupled that with whatever command you are using for checking disk space, viola, you have a shell script.

Posted: Sun Jan 28, 2007 4:31 pm
by chulett
Are you sure you have to monitor it? Most businesses will already have such monitoring in place and I've found you typically just need to let them know to include DataStage in that process. Check here every X and alarm when usage hits Y percent. Have you contacted your SAs and asked them? :?

Our 'DataStage' partition, for example, is checked every 15 minutes... in 3 or 4 hours the damage is more than likely already done.