Email through Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Email through Script
# 1  
Old 03-21-2005
Email through Script

I have a script to sent email when error occur in the process. The scripts use a config file where I dot . ./config.cfg into the environment. However, when I export the message below into the environment and echo $msg, it shows only "THERE" the first word in the sentence.

export msg=THERE WERE XX RECORDS IN ERROR TABLE,AAAA, WHEN LOADING THE BBBB TABLE WITH EXTRACT FROM CCCC INTO TERADATA TABLES FOR MERCHANDISE PLANNING, DATABASE DDDD.

XX - number of records
AAAA - error table name
BBBB - MP table, which has problem during the loading.
CCCC - system name, which provides the extract
DDDD- database name

What is the best handle the message and still allow my script to do subtitution XX, AAAA, BBBB .. etc?
rkumar28
# 2  
Old 03-21-2005
Quote:
Originally Posted by rkumar28
I have a script to sent email when error occur in the process. The scripts use a config file where I dot . ./config.cfg into the environment. However, when I export the message below into the environment and echo $msg, it shows only "THERE" the first word in the sentence.

export msg=THERE WERE XX RECORDS IN ERROR TABLE,AAAA, WHEN LOADING THE BBBB TABLE WITH EXTRACT FROM CCCC INTO TERADATA TABLES FOR MERCHANDISE PLANNING, DATABASE DDDD.

XX - number of records
AAAA - error table name
BBBB - MP table, which has problem during the loading.
CCCC - system name, which provides the extract
DDDD- database name

What is the best handle the message and still allow my script to do subtitution XX, AAAA, BBBB .. etc?
Don't forget that you need double quotes around the string you are putting into the variable $msg.

Code:
export msg="THERE WERE XX RECORDS IN ERROR TABLE,AAAA, WHEN LOADING THE BBBB TABLE WITH EXTRACT FROM CCCC INTO TERADATA TABLES FOR MERCHANDISE PLANNING, DATABASE DDDD."

Also, if AAAA XX and BBBB are variables, you need to reference them as $AAAA $XX and $BBBB.
# 3  
Old 03-21-2005
Quote:
Originally Posted by dangral
Don't forget that you need double quotes around the string you are putting into the variable $msg.

Code:
export msg="THERE WERE XX RECORDS IN ERROR TABLE,AAAA, WHEN LOADING THE BBBB TABLE WITH EXTRACT FROM CCCC INTO TERADATA TABLES FOR MERCHANDISE PLANNING, DATABASE DDDD."

Also, if AAAA XX and BBBB are variables, you need to reference them as $AAAA $XX and $BBBB.
Thanks a lot that worked......
rkumar28
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need little script to send out email

Hi Scripters, good day. bash-4.2# df -g /apps/prd Filesystem GB blocks Free %Used Iused %Iused Mounted on /dev/xxx 64.00 4.35 94% 1269284 8% /xxx bash-4.2# I was wondering if there is a script when the usage of the mountpoint above hit 98%, email would be... (3 Replies)
Discussion started by: jaapar
3 Replies

2. Shell Programming and Scripting

Simple Email Script

Hi All, Im completely new to scripting but I was wondering can somebody show me how to write a bash script so that if any file enters a specific directory that an email gets sent? I am running a few backups on a few different machines and rysncing them to a remote device, For each server I... (5 Replies)
Discussion started by: jgalvin
5 Replies

3. Shell Programming and Scripting

Email not being sent from shell script

Hi All, I have prepared the below shell script but no email is being sent from the shell script.Not sure what's wrong here: echo $SHELL /bin/bash . $HOME/.profile . /home/oracle/Oracle_xyz.env export log=/orabin/Oracle/rman_Oracle_arch.out rman target /... (4 Replies)
Discussion started by: a1_win
4 Replies

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

5. Shell Programming and Scripting

Getting Email from script

I am running a script from crontab and sending the output to another file. This is the statement in crontab: 45 23 * * * /dst/nikutst/clarity/lib/DSTRestartTest1.sh >> /dst/nikutst/clarity/logs/RestartTest.log The script runs fine and sends output to the log file. But I always get a system... (3 Replies)
Discussion started by: snturner
3 Replies

6. Shell Programming and Scripting

Caller Script should produce and email from 4 different script within it

Hi I wrote a shell script , which includes one output file which is emailed back to me , when the script runs . Now i want to slip the script into 4 different shell scripts each of which taking the parameter PROD or DEV, and include all the 4 different shell scripts in a caller script. ... (3 Replies)
Discussion started by: rxg
3 Replies

7. Shell Programming and Scripting

Email Attachment Script

Hello, I created the following script but i'm trying to figure out why i keep getting an error. #!/usr/bin/perl -w use strict; use warnings; my $baseDir = '/export/home/omcadmin/bin'; my $attachment = "$baseDir/message.txt"; my $from = 'xxx@xxx.com'; my $to = 'xxx@xxx.com'; my... (10 Replies)
Discussion started by: xmaverick
10 Replies

8. Programming

email extract script

i want to extract the field from, subject and email body part from an inbox on linux redhat 7.x. prefer perl script or any unix utilities script. please help. :confused: (1 Reply)
Discussion started by: gxiong
1 Replies

9. UNIX for Advanced & Expert Users

route email to a script.

Issue: when i send an email to edi@qgatu001.con-way.com it is supposed to get sent to the deliveryagent es_mime_in so it can get proccessed. ok i got this to happen 1x. Will update over the weekend when i can test to let you know if it works completely. sendmail: 8.12.10. sendmail.mc was... (2 Replies)
Discussion started by: Optimus_P
2 Replies

10. Shell Programming and Scripting

Email alert script

I need to code a script, which will run via cron, every 30 minutes. The script will read a file containing a date&time and number (which represents disk space). The file gets appended to every 30 minutes. Here's a sample of the file: CPU 1:04/25/02 1:00 am:1972554 CPU 1:04/25/02 1:30... (1 Reply)
Discussion started by: moon
1 Replies
Login or Register to Ask a Question