Help with integrating shell script with sendmail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with integrating shell script with sendmail
# 1  
Old 06-10-2012
Help with integrating shell script with sendmail

Hi friends,
I want to converting a task ,of making few words in my task mail bold and underlined sometimes, automated through sendmail.
I have never used sendmail/mailx before.

What i want is my ouput which looks like below:

+++++++++++++++
DETAILS: sqlid:6mbiosdfsdff parsing_schema_name:
BIND VALUES:
Snap Bind Bind Bind Bind
Time SNAP_ID Name Pos Datatype Value
----------------- -------------- ---------- -----
25-APR-12 326153 :1 1 CHAR 0
326153 :2 2 CHAR 0
326153 :3 3 NUMBER 40000
+++++++++++++++
--My shell script which gives me needed output is (actual script is much more complex with many more columns in first sql statement)
Code:
/home/kp456 > cat sql_analysis
#!/usr/bin/ksh
# Usage : ksh sql_analysis 10JUN12 sqlid.lst INST4
export ORACLE_HOME=/home/kp456/oracle/product/10.2.0
export PATH=$ORACLE_HOME/bin:./:${PATH}
export TNS_ADMIN=/home/kp456/tns/
export MY_DIR=/home/kp456/LOGS
export SQLCMD=$ORACLE_HOME/bin/sqlplus

first_variable=$1
second_variable=$2
third_variable=$3
sqlid_list=$second_variable
TEST_TAB=FULL_TABLE_SCAN_${first_variable}

if [[ $third_variable = "INST4" ]] then
CONN=testuser/testpass@INST4
elif [[ $third_variable = "INST5" ]] then
CONN=testuser/testpass@INST5
elif [[ $third_variable = "INST6" ]] then
CONN=testuser/testpass@INST6
elif [[ $third_variable = "INST7" ]] then
CONN=testuser/testpass@INST7
else
echo "wrong instance name"
CONN=""
fi


cat $sqlid_list | while read LINE
do
SQL_ID=`echo $LINE`
$SQLCMD -s $CONN << EOF
set heading off feedback off
select PICK " SQL DETAILS" from
(with t as (select 'sqlid:'|| sql_id ||'parsing_schema_name :' ||parsing_schema_name DETAILS
    FROM $TEST_TAB )
where sql_id = '${SQL_ID}')
select 'DETAILS: ' || DETAILS  PICK
from t
/

col name for a35
col VALUE_STRING for a25
set heading on feedback off
prompt BIND VALUES:
select  vbc.HASH_VALUE,
        vbc.CHILD_ADDRESS,
        vbc.CHILD_NUMBER,
        vbc.NAME,
        vbc.POSITION,
        vbc.DATATYPE,
        vbc.WAS_CAPTURED,
        vbc.VALUE_STRING
from
        v\$sql_bind_capture vbc
where
vbc.sql_id       = '${SQL_ID}'
order by vbc.CHILD_NUMBER,vbc.POSITION
/

quit
EOF
done
exit

--From this forum i have found this script which can be used for "bolding" few words

Code:
#!/usr/bin/ksh

export MAILTO="kp456@txt.com"
export SUBJECT="test message"
(
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 echo "<HTML><BODY>"
 echo "Test to see if <B>bold</B> works."
 echo "</BODY></HTML>"
) | /usr/sbin/sendmail $MAILTO

Few more details:
1. i have sqlid.lst which will sql ids which will specific to a instance.
2. There will be many more columns in my first sql .

Please suggest how i can accomplish this task as the challenges i am facing are:
1. It has to be a single which should contain all the details
2. how to bold only specific parts of text while leaving remaining as it is in my script output.


Thanks,
Kunwar
# 2  
Old 07-12-2012
Hey friends,
Can anyone please comment on my question?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Integrating bash shell

Hi folks... I am working on a project where I need to have online bash bash shell integrated in my web page. I am not clear of how to do it. can any one suggest?? The UI needs to be developed in c#. (11 Replies)
Discussion started by: keerthi koneru
11 Replies

2. Programming

Integrating website member’s profiles?

Hi! I have an accessible website with many register members. I am wondering if you could help me in taking the first step to integrate associate profiles/message to my new and advance database Is this something that should be coded from scratch? Or is there existing software that I can integrate... (1 Reply)
Discussion started by: AimyThomas
1 Replies

3. Programming

Integrating Jconsole with Eclipse

Hi Guys, I was hoping someone has integrated Eclipse with jconsole to monitor their applications. I have not seen this in action . Any help is much appreciated http://images.devshed.com/fds/smilies/smile.gif Thanks (0 Replies)
Discussion started by: aish11
0 Replies

4. UNIX for Dummies Questions & Answers

Integrating bash script into php (page)

I have written a bash script...now i need to call the script from php page. Can you give me an example to demonstrate how it is done?:( (1 Reply)
Discussion started by: xerox
1 Replies

5. UNIX for Dummies Questions & Answers

Integrating bash with sql.

Hi Guys, I m just curious to know whether it is possible to store the output of a shell command to a database . My main aim is to use a full capacity of sql language to analyze the output generated by shell script. for example. by storing the 5 instances of of top at different interval we... (6 Replies)
Discussion started by: pinga123
6 Replies

6. Shell Programming and Scripting

Using sendmail utility in K Shell script

Hi, I am new to shell scripting and thus any help will be highly appreciated. I need to write a K shell script where in the email sending feature should be handled by sendmail utility and I have come up with the following : #!/usr/bin/ksh echo "This is a test mailest mail" | /usr/lib/sendmail... (4 Replies)
Discussion started by: sdiptanil
4 Replies

7. UNIX for Advanced & Expert Users

About XML file Integrating to a table

Hi , I have a question about unix shell scripting. I hope someone may help me to solve problem. In our system , there are two server that generate two different log file which are XML format in UNIX system. The problem is , this XML files contain such counter names and values sometimes this... (1 Reply)
Discussion started by: kbiricik
1 Replies

8. UNIX for Advanced & Expert Users

Integrating unix with Active Directory

Hey guys. Maybe this should go in Security, I'm not sure... At my work we make websites. Our development servers for these websites are run on a central Debian linux server which we can SSH into, which also contains all the files for these websites. These files are served to the entire... (1 Reply)
Discussion started by: nottrobin
1 Replies

9. Programming

about wave file integrating.

Now I have two wave file(*.wav) at Tru64 Unix machine. I want to make a new wave file including the two wave file. how I should finish this programmer. If you know, can you give me the format of the wave file(*.wav) and Sun au file(*.au). Thank you. (1 Reply)
Discussion started by: livic
1 Replies
Login or Register to Ask a Question