![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to send an email? | aajan | UNIX for Dummies Questions & Answers | 1 | 06-12-2007 04:53 AM |
| How to Send email in UNIX | cooolthud | Shell Programming and Scripting | 1 | 01-23-2007 08:49 AM |
| send email to more users | duke0001 | UNIX for Dummies Questions & Answers | 4 | 03-21-2006 12:58 PM |
| Send email where # is in the email address - Using Unix | jingi1234 | UNIX for Dummies Questions & Answers | 1 | 05-23-2005 11:23 AM |
| Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win) | Vetrivela | UNIX for Advanced & Expert Users | 2 | 02-15-2005 10:43 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Send email to user when condition met
Hi all,
I plan to write a shell script to inform users on their task when certain condition met. example: If a then email user on action a else email user on action b. I'm pretty new in scripting, appreciate any suggestions. Thanks. |
|
||||
|
start with something like this maybe:
Code:
#!/bin/sh
#
# email a message
# $1 = action
# $2 = count
# $3= user@myplace.com
email_it()
{
echo "Action: $1 count: $2" | \
/usr/bin/mailx -s "Action notification" "$3"
}
if [ $action = "A" ] ; then
email_it "ACTION WAS A" 42 "john.smith@some.com"
else
email_it "ACTION WAS B" 42 "john.smith@some.com"
fi
|
|
||||
|
Thanks a lot, I had get it done. Another question, the sender of the file will be Super-User <root@hostname>. I wish to change the root to the name of the script I wrote. Is it possible to do so? Thanks.
|
| Sponsored Links | ||
|
|