Sponsored Content
Full Discussion: Solaris: email to user
Operating Systems Solaris Solaris: email to user Post 302382938 by TonyFullerMalv on Sunday 27th of December 2009 10:05:09 AM
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
 

7 More Discussions You Might Find Interesting

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

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

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

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

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

7. 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
All times are GMT -4. The time now is 05:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy