Sponsored Content
Top Forums Shell Programming and Scripting Help....script check status if see something then send email Post 302865517 by dotran on Friday 18th of October 2013 04:53:27 PM
Old 10-18-2013
Thanks RudiC and CaloM,

But seem like not work with pipes or with space on autorep -m "bogus|mirage"

autorep -m bogus
Machine Name Max Load Current Load Factor O/S Status
________________________________________________________________________________ __________ ____________ _______ ___________ ______
bogus --- --- 1.00 Sys Agent Missing
autorep -m "bogus|mirage"
CAUAJM_E_50111 Invalid Machine Name: bogus|mirage
autorep -m mirage
Machine Name Max Load Current Load Factor O/S Status
________________________________________________________________________________ __________ ____________ _______ ___________ ______
mirage 100 0 1.00 Sys Agent Online
SERVERS="server1 server2 server3"
while :
do for S in $SERVERS
do CM=$(autorep -m $S |
awk 'NR<3 {next}
/Offline|Missing|Unqualified/ {print $1, $NF; exit}
{exit 1}
') &&
{ echo "check the agent is $CM"
echo "mailx -s Warning $CM abc@test.com"; } ||
sleep 10
done
done

Last edited by dotran; 10-18-2013 at 06:03 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk to find the status and send an email

Hi, I have a datafile which has the following data and it can have much more records. The data set is as follows: ISA~00~ ~00~ ~ZZ~F159B ~ZZ~U1CAD ~051215~184 3~U~00200~000011432~0~P~< GS~FA~TC11A~U1CAD~051215~1843~000011432~X~002002 ST~997~0001... (6 Replies)
Discussion started by: isingh786
6 Replies

2. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies

3. Shell Programming and Scripting

Script to check processes and send an email

I searched through the forum and couldn't quite find what I was looking for. I have a script that looks for a process "DW" to be running. If it is not it will email a notice to an account. I would like to add the functionality to have it also email a seperate notice if there is more that one of... (1 Reply)
Discussion started by: heprox
1 Replies

4. UNIX for Dummies Questions & Answers

unix script to check if rsh to box and send status mail

rshstatus=`rsh -n lilo /db/p2/oracle/names9208/restart_names.sh` if $rshstatus <>0 then errstatus=1 mailx -s "xirsol8dr" ordba@xxx.com >> $log_dr else if errstatus=0 echo "status to xirsol8dr successful" can anyone provide if this is t he correct way to do this or is there a better way? (1 Reply)
Discussion started by: bpm12
1 Replies

5. Shell Programming and Scripting

Check space of directories and send email if it has reached threshold limit

Hi, I need help in writing unix script for checking space of some directories on the system and also send an email when it reaches the threshold limit. I have written the followng code; #!/bin/ksh ADMIN="me@somewhere.com" # set alert level 80% is default THRESHOLD=80 df | grep -E... (5 Replies)
Discussion started by: jmathew99
5 Replies

6. Shell Programming and Scripting

Grep Stop status from the output of script and send an eamil alert.

Hello Team, I have script which gives below output. Server clustServer11 is in a STARTED state Server clustServer12 is in a STOPPED state Server clustServer21 is in a STOPPED state I would like to prepare script which will grep stop word from the above output and send an email alert. (5 Replies)
Discussion started by: coolguyamy
5 Replies

7. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

8. Shell Programming and Scripting

Help with Email Status shell script

I have written a bash script to to sort the data from logs i need some help in printing the outputs , i dont have much ideas in bah scripting. Sample script ----------------------- #!/bin/bash a=`date | cut -d " " -f2,2,3` cat /var/log/maillog |grep "$a" |grep -E -e 'deferred|bounced'... (9 Replies)
Discussion started by: unimaxlin
9 Replies

9. Shell Programming and Scripting

Script to email status

Hi, I have few processes in the server continuous run few jobs, each of the process will generate a log file which detailing when its jobs are completed. the logfile will has the name something like this, result1.log, result2.log, result3.log,.... result10.log, result11.log, result12.log.......... (8 Replies)
Discussion started by: khchong
8 Replies

10. Shell Programming and Scripting

Send Disk Space Usage Status via email

Hi Guys, Is there any way I can write a script that sends DISK SPACE USAGE STATUS via email once a week? Thanks, (5 Replies)
Discussion started by: g4v1n
5 Replies
SPLAIN(1)						 Perl Programmers Reference Guide						 SPLAIN(1)

NAME
diagnostics, splain - produce verbose warning diagnostics SYNOPSIS
Using the "diagnostics" pragma: use diagnostics; use diagnostics -verbose; enable diagnostics; disable diagnostics; Using the "splain" standalone filter program: perl program 2>diag.out splain [-v] [-p] diag.out Using diagnostics to get stack traces from a misbehaving script: perl -Mdiagnostics=-traceonly my_script.pl DESCRIPTION
The "diagnostics" Pragma This module extends the terse diagnostics normally emitted by both the perl compiler and the perl interpreter (from running perl with a -w switch or "use warnings"), augmenting them with the more explicative and endearing descriptions found in perldiag. Like the other pragmata, it affects the compilation phase of your program rather than merely the execution phase. To use in your program as a pragma, merely invoke use diagnostics; at the start (or near the start) of your program. (Note that this does enable perl's -w flag.) Your whole compilation will then be subject(ed :-) to the enhanced diagnostics. These still go out STDERR. Due to the interaction between runtime and compiletime issues, and because it's probably not a very good idea anyway, you may not use "no diagnostics" to turn them off at compiletime. However, you may control their behaviour at runtime using the disable() and enable() methods to turn them off and on respectively. The -verbose flag first prints out the perldiag introduction before any other diagnostics. The $diagnostics::PRETTY variable can generate nicer escape sequences for pagers. Warnings dispatched from perl itself (or more accurately, those that match descriptions found in perldiag) are only displayed once (no duplicate descriptions). User code generated warnings a la warn() are unaffected, allowing duplicate user messages to be displayed. This module also adds a stack trace to the error message when perl dies. This is useful for pinpointing what caused the death. The -traceonly (or just -t) flag turns off the explanations of warning messages leaving just the stack traces. So if your script is dieing, run it again with perl -Mdiagnostics=-traceonly my_bad_script to see the call stack at the time of death. By supplying the -warntrace (or just -w) flag, any warnings emitted will also come with a stack trace. The splain Program While apparently a whole nuther program, splain is actually nothing more than a link to the (executable) diagnostics.pm module, as well as a link to the diagnostics.pod documentation. The -v flag is like the "use diagnostics -verbose" directive. The -p flag is like the $diagnostics::PRETTY variable. Since you're post-processing with splain, there's no sense in being able to enable() or disable() processing. Output from splain is directed to STDOUT, unlike the pragma. EXAMPLES
The following file is certain to trigger a few errors at both runtime and compiletime: use diagnostics; print NOWHERE "nothing "; print STDERR " This message should be unadorned. "; warn " This is a user warning"; print " DIAGNOSTIC TESTER: Please enter a <CR> here: "; my $a, $b = scalar <STDIN>; print " "; print $x/$y; If you prefer to run your program first and look at its problem afterwards, do this: perl -w test.pl 2>test.out ./splain < test.out Note that this is not in general possible in shells of more dubious heritage, as the theoretical (perl -w test.pl >/dev/tty) >& test.out ./splain < test.out Because you just moved the existing stdout to somewhere else. If you don't want to modify your source code, but still have on-the-fly warnings, do this: exec 3>&1; perl -w test.pl 2>&1 1>&3 3>&- | splain 1>&2 3>&- Nifty, eh? If you want to control warnings on the fly, do something like this. Make sure you do the "use" first, or you won't be able to get at the enable() or disable() methods. use diagnostics; # checks entire compilation phase print " time for 1st bogus diags: SQUAWKINGS "; print BOGUS1 'nada'; print "done with 1st bogus "; disable diagnostics; # only turns off runtime warnings print " time for 2nd bogus: (squelched) "; print BOGUS2 'nada'; print "done with 2nd bogus "; enable diagnostics; # turns back on runtime warnings print " time for 3rd bogus: SQUAWKINGS "; print BOGUS3 'nada'; print "done with 3rd bogus "; disable diagnostics; print " time for 4th bogus: (squelched) "; print BOGUS4 'nada'; print "done with 4th bogus "; INTERNALS
Diagnostic messages derive from the perldiag.pod file when available at runtime. Otherwise, they may be embedded in the file itself when the splain package is built. See the Makefile for details. If an extant $SIG{__WARN__} handler is discovered, it will continue to be honored, but only after the diagnostics::splainthis() function (the module's $SIG{__WARN__} interceptor) has had its way with your warnings. There is a $diagnostics::DEBUG variable you may set if you're desperately curious what sorts of things are being intercepted. BEGIN { $diagnostics::DEBUG = 1 } BUGS
Not being able to say "no diagnostics" is annoying, but may not be insurmountable. The "-pretty" directive is called too late to affect matters. You have to do this instead, and before you load the module. BEGIN { $diagnostics::PRETTY = 1 } I could start up faster by delaying compilation until it should be needed, but this gets a "panic: top_level" when using the pragma form in Perl 5.001e. While it's true that this documentation is somewhat subserious, if you use a program named splain, you should expect a bit of whimsy. AUTHOR
Tom Christiansen <tchrist@mox.perl.com>, 25 June 1995. perl v5.14.2 2014-09-30 SPLAIN(1)
All times are GMT -4. The time now is 06:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy