Sponsored Content
Top Forums Shell Programming and Scripting Send email to user when condition met Post 302078167 by jim mcnamara on Wednesday 28th of June 2006 11:34:12 AM
Old 06-28-2006
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

 

10 More Discussions You Might Find Interesting

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

2. Shell Programming and Scripting

How to break a loop if condition is met

I am having trouble figuring this code I want to grep a text from a file and if it match certain text it break out of the loop or it should continue searching for the text Here is what I have written but it isn't working while true f=`grep 'END OF STATUS REPORT' filename` do if ... (9 Replies)
Discussion started by: Issemael
9 Replies

3. Shell Programming and Scripting

do nothing if condition is not met but not exit

Hello all, I created the below script....and it seemed to be working fine. My problem is i want the script to ignore rest of the things if my condition is not met but do not exit.... #!/bin/ksh ########################### ########################### # Set name of the listener, this... (2 Replies)
Discussion started by: abdul.irfan2
2 Replies

4. UNIX for Advanced & Expert Users

While loop only if a condition is met

All, I wrote the following section of code (which logically in PHP would of worked): tmpPATH=${1} tmpTAG=${2} if then while read tmpTAG tmpPATH do fi echo $tmpTAG echo $tmpPATH if then done < ./config.cfg fi (4 Replies)
Discussion started by: Cranie
4 Replies

5. UNIX for Advanced & Expert Users

send mail script only if condition is met

only wc -l greater than 0 then send email to owner, otherwise do nothing. ie. result=powermt display dev=all|awk '{print $7}'|grep -i dead|wc -l if then echo $result else : fi mailx -s "there is dead path (s)" "mymail@mydomain.com" ----------- it is not working... (2 Replies)
Discussion started by: orafup
2 Replies

6. Shell Programming and Scripting

Send email if the condition matches

Hello everyone, I am trying to create function or script to send email from an address book file. Here is the file format i have, Susan:Miller:M:123 Main Street:Philadelphia:PA:17101:666-645-6666:Susan.Miller@gmail.com:07/12/1979 Robert:Langan:S:32 North Avenue:San... (5 Replies)
Discussion started by: asistant
5 Replies

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

8. Shell Programming and Scripting

Getting the records once condition met

Hi All, Seeking for your assistance to get the records once the $2 met the condition. Ex. file 1.txt 123455,10-Aug-2020 07:33:37 AM,2335235,1323534,12343 123232,11-Aug-2015 08:33:37 PM,4234324,1321432,34364 Output: 123455,10-Aug-2020 07:33:37 AM,2335235,1323534,12343 What i did... (5 Replies)
Discussion started by: znesotomayor
5 Replies

9. Shell Programming and Scripting

Need help on how to append on the filename when condition met.

Hi All, Seeking for your assistance on how to append the specific string when $3 condion met. ex. file1.txt ar0050046b16,5,888,0,0,0,0.00,0.00,0.00,0.00,25689.55 ar0050046b16,5,0,0,0,0,0.00,0.00,0.00,0.00,25689.55 ar0050046b16,5,0,0,0,0,0.00,0.00,0.00,0.00,25689.55 expected output:... (5 Replies)
Discussion started by: znesotomayor
5 Replies

10. UNIX for Beginners Questions & Answers

awk - print when condition is met

I have a file.txt containing the following: Query= HWI-ST863:386:C5Y8UACXX:3:2302:16454:89688 1:N:0:ACACGAAT Length=100 Score E Sequences producing significant alignments: (Bits) Value ... (2 Replies)
Discussion started by: tons92
2 Replies
Gtk2::ToggleAction(3pm) 				User Contributed Perl Documentation				   Gtk2::ToggleAction(3pm)

NAME
Gtk2::ToggleAction - wrapper for GtkToggleAction SYNOPSIS
my $action = Gtk2::ToggleAction->new (name => 'one', tooltip => 'One'); DESCRIPTION
Note that "new" is the plain Glib::Object "new" (see Gtk2::Action). The name, label, tooltip and stock_id arguments of the C code "gtk_toggle_action_new()" can be given as key/value pairs, plus other property values like active or sensitive. HIERARCHY
Glib::Object +----Gtk2::Action +----Gtk2::ToggleAction INTERFACES
Gtk2::Buildable METHODS
boolean = $action->get_active $action->set_active ($is_active) o $is_active (boolean) boolean = $action->get_draw_as_radio $action->set_draw_as_radio ($draw_as_radio) o $draw_as_radio (boolean) $action->toggled PROPERTIES
'active' (boolean : default false : readable / writable / private) If the toggle action should be active in or not 'draw-as-radio' (boolean : default false : readable / writable / private) Whether the proxies for this action look like radio action proxies SIGNALS
toggled (Gtk2::ToggleAction) SEE ALSO
Gtk2, Glib::Object, Gtk2::Action COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::ToggleAction(3pm)
All times are GMT -4. The time now is 11:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy