Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to create a script that will email once there is an error? Post 302584100 by rymnd_12345 on Thursday 22nd of December 2011 06:45:02 AM
Old 12-22-2011
How to create a script that will email once there is an error?

Hi Guys,

Good day ULF! Can you assist me in creating a script that will email once an error has occurred. It's like this, I have script that is used for monitoring, distinct keywords on the status are OK and Error respectively. Then I created another script that will call for the monitoring script to run so that the new script will save an output into a file. I call it as Status-Collector.sh and I will put it as an entry in cron. This is the sample output that has been generated:
Code:
Date Executed:
--------------
Thu Dec 22 13:30:54 EET 2011


Command Executed: <command-01>
------------------------------------------------------
SNMP Status = OK

Command Executed: <command-02>
--------------------------------------------------------
SYSTEM Status = OK

Command Executed: <command-03>
-----------------------------------------
DISKSPACE Status = OK

Command Executed: <command-04>
-------------------------------------------------------
TOTAL_USER Status = OK

Command Executed: <command-05>
---------------------------------------------------------------
VR_ROLE Status = OK

Command Executed: <command-06>
server0
--------------------------------------------------------------------------------
RDVR_ROLE Status = OK

Command Executed: <command-07>
------------------------------------------------------
SERVER_BOOT Status = OK

Command Executed: <command-08>
------------------------------------------------------------------------
RDSERVER_BOOT Status = OK

Command Executed: <command-09>
------------------------------------------------------
Error! High Load Average = 1.10 in server8 for the last 5-minutes.

NOTE: Logs can be found in /tmp directory with file extension name of .debug

I want a script that will read per line of the output file and will email if one or more Errors occurred.


Please advice,
rymnd_12345


BTW: I would like to personally thank Unix and Linux Forum, my respect and appreciation to all the members and "staffs" of this. I myself admit that I'm learning a lot each day. Thank you so much, keep-up the great work. God bless!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

create email w/ ASCII attachment via command-line

All, I need to email an ASCII data file to a business partner, and intended on creating a Korn Shell script to create an email message (minimal text), and attach the ASCII data file to the email. It seems this is not as easy as I had thought it might be. sendmail does not support... (3 Replies)
Discussion started by: jwperry
3 Replies

2. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

3. Shell Programming and Scripting

Send email on script error

I need to start off by saying that I am not much of a programmer and know enough to cause lots of trouble. I've been writing this script to decrypt an XML feed, then parse the feed into a database. The script is executed from cron. #!/bin/sh PGPPATH=/path/to/directory echo "pgp... (6 Replies)
Discussion started by: Aslan_Eident
6 Replies

4. Shell Programming and Scripting

Create email Addresses

Hi, I own 2 websites 1world1game.com and thetoonarmy.net. I can access my 1world accont using mediatemples webmail. The problem i am having is that I want to allow users to register an email from a form on 1World1Game such as tom@thetoonarmy.net and be able to access it from 1world1game. ... (2 Replies)
Discussion started by: rmail2006
2 Replies

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

6. AIX

backup script failed with error '0403-005 Cannot create the specified file'

In AIX 5.1, a daily run script that backing up oracle data failed yesterday with following errors: The Tivoli backup of DBPROD failed. What could be the issue, OS, backup or Oracle? (3 Replies)
Discussion started by: jalite19
3 Replies

7. Homework & Coursework Questions

Create script to add user and create directory

first off let me introduce myself. My name is Eric and I am new to linux, I am taking an advanced linux administration class and we are tasked with creating a script to add new users that anyone can run, has to check for the existence of a directory. if the directory does not exist then it has... (12 Replies)
Discussion started by: pbhound
12 Replies

8. Programming

CGI Perl script to execute bash script- unable to create folder

Hi I have a bash script which takes parameters sh /tmp/gdg.sh -b BASE-NAME -n 1 -s /source/data -p /dest/data/archive -m ARC gdg.sh will scan the /source/data and will move the contents to /dest/data/archive after passing through some filters. Its working superb from bash I have... (0 Replies)
Discussion started by: rakeshkumar
0 Replies

9. Shell Programming and Scripting

Script to create folder, copy file, and send email on success

I am very new to UNIX as well as scripting so please be gentle, haha. I have a Linux client which has a mount point mapped to my /etc folder on a NetApp FAS system. I woudl like to be able to copy the hosts and rc files once a week from the FAS to a different location for backup. When the... (4 Replies)
Discussion started by: minnino
4 Replies

10. Shell Programming and Scripting

Shell script to create runtime variables based on the number of parameters passed in the script

Hi All, I have a script which intends to create as many variables at runtime, as the number of parameters passed to it. The script needs to save these parameter values in the variables created and print them abc.sh ---------- export Numbr_Parms=$# export a=1 while do export... (3 Replies)
Discussion started by: dev.devil.1983
3 Replies
Test::Valgrind::Command::PerlScript(3pm)		User Contributed Perl Documentation		  Test::Valgrind::Command::PerlScript(3pm)

NAME
Test::Valgrind::Command::PerlScript - A Test::Valgrind command that invokes a perl script. VERSION
Version 1.13 DESCRIPTION
This command is meant to abstract the argument list handling of a "perl" script. METHODS
This class inherits Test::Valgrind::Command::Perl. "new file => $file, [ taint_mode => $taint_mode ], ..." The package constructor, which takes several options : o $file is the path to the "perl" script you want to run. This option is mandatory. o $taint_mode is actually handled by the parent class Test::Valgrind::Command::Perl, but it gets special handling in this subclass : if "undef" is passed (which is the default), the constructor will try to infer its right value from the shebang line of the script. Other arguments are passed straight to "Test::Valgrind::Command::Perl->new". "file" Read-only accessor for the "file" option. SEE ALSO
Test::Valgrind, Test::Valgrind::Command::Perl. AUTHOR
Vincent Pit, "<perl at profvince.com>", <http://www.profvince.com>. You can contact me by mail or on "irc.perl.org" (vincent). BUGS
Please report any bugs or feature requests to "bug-test-valgrind at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT
You can find documentation for this module with the perldoc command. perldoc Test::Valgrind::Command::PerlScript COPYRIGHT &; LICENSE Copyright 2009,2010,2011 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2011-08-25 Test::Valgrind::Command::PerlScript(3pm)
All times are GMT -4. The time now is 06:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy