Hi!
I'm not really familiar with Oracle. Is the file export_icat.sql a file containing commands for sqlplus? Where does the output go? To the screen (stdout)?
Then You can probably redirect it to a file, let's call it export_icat.out.
Your mail command sends a mail to user@domain.com, with the Subject "Results" and with the body content "Today's Results". Maybe not even that, depending on what the quotes are. If You want to send the content of the text file export_icat.out as the mail body, use:
Best regards,
Lakris
PS There are other commands in Your script that won't work as it is written.
Maybe
should be replaced with something that actually sets these variables?
Last edited by Lakris; 08-24-2010 at 02:58 PM..
Reason: PS...
Hi ,
I just found you while surfing for the string
'Redirecting sql select query output from within a shell script to txt file/excel file'
Could you find time sending me the code for the above question?
It'll be great help for me.
I have a perl file that calls the sql file... (1 Reply)
Hi Yogesh,
Lucky that i caught you online. Yeah i read about DBI and the WriteExcel module. But the server is not supporting these modules. It said..."Cannot locate DBI"..."Cannot locate Spreadsheet::WriteExcel"
I tried creating a simple text file to get the query output, but the... (1 Reply)
Hello Guys...
I want a small help from you guys.
Actually in Oracle, we are having a utlity called spool through which can store whatever SQL statements executed and other queries and the output of those queries in a file
So, similarly in Unix, if I start a session executing a number of Unix... (2 Replies)
Hello,
I run a web hosting company, and I'm wondering how I can use cPanel's Cron Jobs so that a copy of my entire home directory and a copy all of my MySQL databases can be compressed and emailed to me. I know nothing about Linux, Unix, or whatever that thing with the penguin is called. :)
... (7 Replies)
Hi
I need help on this. Its very urgent for me.. please try to help me out..
I have data in tables in DB2 database. I would like to export the data from DB2 tables into a text file, which has to be space delimited. so that I can carry out awk, grep operations on that file. I tried to export... (2 Replies)
I'm having problems with writing my sql results to a file:
sqlplus -S username/password@DB <<!!
set echo off
set verify off
set showmode off
set feedback off
set timing off
set linesize 250
set wrap off
set pagesize 0
set newpage none
set tab off
set trimspool on
set colsep... (1 Reply)
Hi
I want ot save SQL query result in one txt file. for that i have written one code line
sqlplus -s $dbstring @/usr/local/bin/sched/nightly_Cronjob/exec_123.sql >> /usr/local/bin/sched/nightly_Cronjob/result.txt
but it is not working .
database : Oracle
so please advice me how can i... (7 Replies)
Hi,
I am facing issues while exporting the results retrieved from the Database to an excel file.
I have 5 count query in order to count the records in 5 different tables.
I had connected to the DB and retrieved the column count and printed in the screen.
But wat I need to do is, I... (8 Replies)
Hello All,
I am writing the below unix script to email the result of a small pl sql procedure:
#!/bin/bash
ORACLE_HOME=/opt/oracle/orcts/product/9.2.0; export ORACLE_HOME
SQLPLUS=$ORACLE_HOME/bin/sqlplus
sqlplus -s user/pass@Db_instance<<EOF
set echo off
set feedback off
set pages 0... (9 Replies)
Discussion started by: Bunty bedi
9 Replies
LEARN ABOUT CENTOS
bsmtp
BSMTP(1) Network backup, recovery and verification BSMTP(1)NAME
bsmtp - Bacula's SMTP client (mail submission program)
SYNOPSIS
bsmtp [options] <recipient> <...>
DESCRIPTION
bsmtp is a simple mail user agent designed to permit more flexibility than the standard mail programs typically found on Unix systems, and
to ease portability. It can even run on Windows machines. It is used by the Director daemon to send notifications and requests to the oper-
ator.
OPTIONS -4 Forces bsmtp to use IPv4 addresses only.
-6 Forces bsmtp to use IPv6 addresses only.
-8 Encode the mail in UTF-8.
-a Use any ip protocol for address resolution.
-c Set the Cc: header.
-d nn Set debug level to nn.
-dt Print timestamp in debug output.
-f Set the From: header. If not specified, bsmtp will try to use your username.
-h mailhost:port
Use mailhost:port as the SMTP server. (default port: 25)
-s Set the Subject: header.
-r Set the Reply-To:: header.
-l Set the maximum number of lines to be sent. (default: unlimited)
-? Show version and usage of program.
USAGE
recipients is a space separated list of email addresses.
The body of the email message is read from standard input. Message is ended by sending the EOF character (Ctrl-D on many systems) on the
start of a new line, much like many 'mail' commands.
The actual, automated behavior of bsmtp will depend on the mail-related configuration of the Director in the Messages resource of bacula-
dir.conf.
Interactive use of bsmtp is pertinent to manually test and ensure these configuration bits are valid. This is highly recommended.
CONFIGURATION
These commands should each appear on a single line in the configuration file.
Messages {
Name = Standard
mailcommand = "/home/bacula/bin/bsmtp -h mail.domain.com -f "(Bacula) <%r>"
-s "Bacula: %t %e of %c %l" %r"
operatorcommand = "/home/bacula/bin/bsmtp -h mail.domain.com -f "(Bacula) <%r>"
-s "Bacula: Intervention needed for %j" %r"
mail = sysadmin@site.domain.com = all, !skipped
operator = sysop@site.domain.com = mount
console = all, !skipped, !saved
}
home/bacula/bin is replaced with the path to the Bacula binary directory, and mail.domain.com is replaced with the fully qualified name of
an SMTP server, which usually listen on port 25.
ENVIRONMENT
If the -h option is not specified, bsmtp will use environment variable SMTPSERVER, or 'localhost' if not set.
NOTES
Since bsmtp always uses a TCP connection rather than writing to a spool file, you may find that your From: address is being rejected
because it does not contain a valid domain, or because your message has gotten caught in spam filtering rules. Generally, you should spec-
ify a fully qualified domain name in the from field, and depending on whether your SMTP gateway is Exim or Sendmail, you may need to modify
the syntax of the from part of the message.
If bsmtp cannot connect to the specified mail host, it will retry to connect to localhost.
BUGS
If you are getting incorrect dates (e.g. 1970) and you are running with a non-English locale, you might try setting the LANG="en_US" envi-
ronment variable.
AUTHOR
This manual page was written by Jose Luis Tallon <jltallon@adv-solutions.net>, revised and edited by Lucas B. Cohen <lbc@members.fsf.org>.
SEE ALSO bacula-dir(8)Kern Sibbald 3 July 2012 BSMTP(1)