Sponsored Content
Top Forums Shell Programming and Scripting check the status and send an email with status Post 94328 by isingh786 on Thursday 29th of December 2005 10:26:53 AM
Old 12-29-2005
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
AK9~A~2~2~2
SE~8~0001
GE~1~000011258
IEA~00001~000011258

ISA~00~ ~00~ ~ZZ~F159B ~ZZ~U1CAD ~051227~191
3~U~00200~000011467~0~P~<
GS~FA~AF52M~U1CAD~051227~1913~000011467~X~002002
ST~997~0001
AK1~SH~53
AK2~856~530001
AK5~A
AK9~A~1~1~1
SE~6~0001

The data I am looking for is in the first line that starts with ISA and the third column data is “~ZZ~F159B” and “~ZZ~VISTN”.

On the basis of the above mentioned segments, I have to assign them status either as pass or fail, which has been accomplished by the code snippet provided by Vgersh99 and Rancha.

grep "~ZZ~" <data file> | nawk '{ print ($3=="~ZZ~VISTN") ? "passed":"failed" }'

Now the new requirement is that I have to send an email, which should have the status in the body of the email. Can this be achieved in one script or I have to write two scripts like one has the static body of the email and it just expects two arguments.

Template for static email:

Please be advised that the EDI ASN has been “status” (either passed or failed).

Hope this is not too confusing.

Regards,
Inder
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Couldn't open status file /var/samba/STATUS.LCK

I believe i have most of samba configured right but i get this error each time time try to run it. I was given suggestion that i touch the file, i did, but i still cannot rid myself of this error. Any suggestions (2 Replies)
Discussion started by: macdonto
2 Replies

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

3. Red Hat

Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58

I have successfully installed RedHat 8.0 onto a Dell PowerEdge SC1425 today. This server has two SATA hard drives, and an IDE DVD-ROM drive. Using the following kernel parameters, i successfully installed across both hard drives from CD: ide0=0x1f0,0x3f6,14 vga=791 resolution=1024x768 expert... (5 Replies)
Discussion started by: fishsponge
5 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

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

6. Shell Programming and Scripting

Check HD status

I have some server ( IBM , Dell ) , our data center is not in the same location with office , therefore , I do not know if the HD lamp is flash when the HD is fault , can advise if I can write a script to check if the HD is normal running or not ? thanks (1 Reply)
Discussion started by: ust
1 Replies

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

8. Shell Programming and Scripting

Help....script check status if see something then send email

autorep -m bogus Machine Name Max Load Current Load Factor O/S Status ___________ ________ ___________ ______ ________ ______ bogus --- --- 1.00 Sys Agent Online Status ______ Online Offline Missing Unqualified The "Status" always "Online". I like create a script execute run... (6 Replies)
Discussion started by: dotran
6 Replies

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

10. Programming

How to track table status delete/update/insert status in DB2 V10 z/os?

Dear Team I am using DB2 v10 z/os database . Need expert guidance to figure out best way to track table activities ( Ex Delete, Insert,Update ) Scenario We have a table which is critical and many developer/testing team access on daily basis . We had instance where some deleted... (1 Reply)
Discussion started by: Perlbaby
1 Replies
OCF_HEARTBEAT_MAILTO(7) 					OCF resource agents					   OCF_HEARTBEAT_MAILTO(7)

NAME
ocf_heartbeat_MailTo - Notifies recipients by email in the event of resource takeover SYNOPSIS
MailTo [start | stop | status | monitor | meta-data | validate-all] DESCRIPTION
This is a resource agent for MailTo. It sends email to a sysadmin whenever a takeover occurs. SUPPORTED PARAMETERS
email The email address of sysadmin. (required, string, no default) subject The subject of the email. (optional, string, no default) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 10. stop Stops the resource. Suggested minimum timeout: 10. status Performs a status check. Suggested minimum timeout: 10. Suggested interval: 10. monitor Performs a detailed status check. Suggested minimum timeout: 10. Suggested interval: 10. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a MailTo resource using the crm(8) shell: primitive p_MailTo ocf:heartbeat:MailTo params email=string op monitor depth="0" timeout="10" interval="10" SEE ALSO
http://www.linux-ha.org/wiki/MailTo_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 06/09/2014 OCF_HEARTBEAT_MAILTO(7)
All times are GMT -4. The time now is 11:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy