Solaris: email to user


 
Thread Tools Search this Thread
Operating Systems Solaris Solaris: email to user
# 1  
Old 12-27-2009
Solaris: email to user

Hi,

I would like to run cron job daily at 8:00 P.M in order to check the filesysem sizes , if if finds any filesystem space reaches to 90% it should me an email address to my outlook ( xxxxxx@abcd.com ) .

need your suggestion or direction how to achieve this.

Regards
# 2  
Old 12-27-2009
Assuming you have are monitoring the /var filesystem on a Solaris system then you could use:
Code:
$ df -k /var
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c0t0d0s3     138703    65426  59407    53%    /var
$

So to extract the value you could use:
Code:
$ df -k /var | grep /var$ | awk '{ print $5 }'

Which will extract the percentage full (the fifth item in the list) avoiding picking up the fifth item in the header line.

So in a script you would so:
Code:
PERCENTFULL=`df -k /var | grep /var$ | awk '{ print $5 }'`

You can then test for a value greater than 90% you can do:
Code:
if [ ${PERCENTFULL} -gt 90 ]; then
  send_an_email
fi

Sending an email depends on what you have on your system, on Solaris I would use mailx thus:
Code:
mailx -s "Subject heading" person@domain.com < inputfile

Where you have put what you want to send in the message in inputfile.

You would then call the resulting script from cron at 8pm every night:
Code:
0 20 * * * /usr/local/bin/yourscript.sh

HTH
# 3  
Old 12-30-2009
Hi,
Thanks for your update,
could you help me to comeout of this mailx problem , I dont why it couldnot able to send message to one of my Microsoft Outlook email .

Regards
# 4  
Old 12-30-2009
Use the -v flag:

Code:
mailx -v -s test youraddress@domain.com
hello world
.

It will come out with a bunch of messages. If all goes well, check /var/log/mail.log
# 5  
Old 12-30-2009
The part of the log that shows what mail server it is talking to would be helpful.

The MS Exchange server has to have SMTP enabled - you'll need to ask and Exchange expert about how to do that.

For Solaris 8 and below to make your Solaris machine use a particular machine as its mail server you can put an entry into its /etc/hosts file giving the IP address, name and then an alias of mailhost, this can be done in DNS using a MX (mail exchanger) record..
# 6  
Old 01-02-2010
Hi ,

I found this error messages when i use below switch with mailx
Code:
$mailx -v -s  test maooah@mail.com
hello world
.
EOT
DRIAD@root $mrai.com: Name server timeout
maooah@mail.com... Transient parse error -- message queued for future delivery
maooah@mail.com... queued

Regards

Last edited by Scott; 01-04-2010 at 03:03 AM.. Reason: Added code tags
# 7  
Old 01-02-2010
Looks like DNS is broken, presumably at the mrai.com end, but it is worth checking DNS is working at your end.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Regarding registration email for new user

Hello Moderators, Greetings !! This is regarding my friend to whom I refered this forum to learn UNIX. User didn't receieved any registration email yet, could you please help user. Will be grateful to you on same. Login name: Gurvinder_Kaur NOTE: User doesn't have enough bits for... (0 Replies)
Discussion started by: RavinderSingh13
0 Replies

2. Shell Programming and Scripting

Send one email per user

I created a bash script that gets a file formats it, sends an email to the user(s), however, for whatever reason, it will send an email per line with all of the lines in it, so essentially the user will get 10 duplicate emails with the same 10 results. I've modified the script to put the results of... (2 Replies)
Discussion started by: hotdang
2 Replies

3. Shell Programming and Scripting

Write a scripts to kill idle user for 60 min. & email user list to admin in text file

Folks, I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3) List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
Discussion started by: sumit30
4 Replies

4. Shell Programming and Scripting

Email sent to multiple user address?

hi all, This is user that i want sent the email: Email = allan@gmail.com bruce8899@gmail.com Chris@gmail.com echo "$dir : $filecount is over the limit $limit " | mailx -s "${SUBJECT}" "${email}" However it cannot sent to 3 user..only sent to 1 user email address. Any 1 can help me... (15 Replies)
Discussion started by: proghack
15 Replies

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

6. UNIX for Advanced & Expert Users

Send email as a different user than the user logged in

Hi I am using mailx to send email and am wondering if there is a way I can send the email from a different user than the user logged in. something like do-not-reply@xyz.com Thank you. (1 Reply)
Discussion started by: rakeshou
1 Replies

7. Programming

Sending email to a User from C++

How do i send a mail to User from c++? (1 Reply)
Discussion started by: debu
1 Replies
Login or Register to Ask a Question