Shell script to email logfile


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Shell script to email logfile
# 1  
Old 04-30-2014
Shell script to email logfile

Hi,

I am trying to write a shell script to send a log file of a query run in oracle.Pls help me I am very new to shell scripting.

Code:
echo " Checking Activity Spec "
sqlplus / as sysdba <<END_SQL
@activity_spec_metadata.sql
quit;>>logfile
END_SQL
mailx -s "Checking Activity Spec schedule " abc@gmail.com >> logfile
exit 0

Moderator's Comments:
Mod Comment Please use CODE tags (not ICODE tags) for multi-line code, input, and output samples.

Last edited by Don Cragun; 04-30-2014 at 03:49 PM.. Reason: Fix tags.
# 2  
Old 04-30-2014
Code:
#!/bin/ksh

echo " Checking Activity Spec " > logfile

sqlplus -s / as sysdba <<END_SQL >> logfile
@activity_spec_metadata.sql
exit;
END_SQL

cat logfile | mailx -s "Checking Activity Spec schedule " abc@gmail.com

exit 0

This User Gave Thanks to SriniShoo For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script, sftp logfile not showing transfer information

Hello, Recently I have changed some crontab scripts which I execute to do different tasks mainly transfering some files from one server to the other. The main change was the protocol from ftp transfer to sftp. Ftp server was the MS Windows default service, and Sftp server is an proprietary sw... (4 Replies)
Discussion started by: enux
4 Replies

2. Shell Programming and Scripting

How to tail -f multi logfile in 1 shell script.?

Hello, How to tail -f multi logfile from multi path in 1 shell script. File & Path /usr/home/localmode/mode110l/log/logic/number110/digit110_digit110m4_2013050210.txt /usr/home/localmode/mode103l/log/logic/number103/digit103_digit103m4_2013050210.txt... (4 Replies)
Discussion started by: ooilinlove
4 Replies

3. Shell Programming and Scripting

Email Attachments in shell script

Hi Fellas, I have a script that queries a sybase DB through isql and appends to a file, say file.csv I want to use the mail command in the shell script to email the file to me. i tried the following command but it doesn't work. can any one suggest whats wrong here. Note that i need the file... (2 Replies)
Discussion started by: Irishboy24
2 Replies

4. Shell Programming and Scripting

generate logfile in a shell script

Unix Gurus, I have a shell script which has few "echo" statements. I am trying to create a logfile where all the outputs of the echo statement sare stored. I will have to add this as the final step in the existing script so that everytime the script runs, a logfile is generated with all the... (1 Reply)
Discussion started by: shankar1dada
1 Replies

5. Shell Programming and Scripting

Help with shell script to send email once

Hi Guys, I have this script which will monitor oracle db process if up or down.And I want it to send email if it's down and the time it's back to online. However my script just keep on sending "Email Up" if the db is up or "Email Down" if the db is down.Is there any way to trap it so that it... (5 Replies)
Discussion started by: d3xt3r
5 Replies

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

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

8. Shell Programming and Scripting

Sending email from shell script

Hi, I need to send email from a shell script. i echoed some information to a file and i am doing cat command in the email syntax thanks (2 Replies)
Discussion started by: rocky1954
2 Replies

9. Shell Programming and Scripting

How to send email through shell script

Hi All, I am new to the unix , i have to deliver one script very urgently I have to write a shell script where i have i want to send email to specific email id in this script i want FROM to be parameterized and stored in a variable TO to be parameterized and stored in a variable... (3 Replies)
Discussion started by: nileshbhawsar
3 Replies

10. Shell Programming and Scripting

Korn Shell Script to find out error in logfile

Hi All, I am new to this forum as well as to unix scripting. Can you please help me to create a korn shell script to find out errors in logfiles and get the name of that logfile ( which is having error) in email and email it to me? (2 Replies)
Discussion started by: jithu
2 Replies
Login or Register to Ask a Question