06-25-2009
Sending one email for every row as per sql result
I want to send email for every row comes out of following SQL statement
thank you for your help.
*****SQL STATEMENT******
Select SCUSER AS "USER IDS" , SCEUSER AS "LOCKED OUT" FROM SYS.7333.F98OWSEC;
*******OUPUT COMES LIKE THIS AND ONE EMAIL COMES AS PER SCRIPT BELOW******
******BUT MY REQUIREMENT IS A SEPRATE EMAIL FOR EVERY LOCKED ID/ROW****
Jun 25 2009 06:00:02
"Following System User Ids Locked Out"
User Id
----------
LJOHNSTON
CTONOLETE
MEDWARDS
MLOVELESS
SALTOSJ
****EMAIL SCRIPT*********
#!/bin/sh
. /home/oracle/.cron_profile
#
export LOGDIR=/home/oracle/log
cd /home/oracle
#
sqlplus /nolog @/home/oracle/Daily_lockedout.sql
#
cat $LOGDIR/Daily_lockedout.log >>$LOGDIR/Daily_lockedout.all.log
uuencode /home/oracle/log/Daily_lockedout.log Daily_lockedout.log |mail -s "Daily_lockedout.log"
jxx@TGT.com;
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
i would like to retrieve seql result and write it into unix text file like "result.txt"
In unix, normally, I type "sql" and get into sql,then type "select....." to run and get the result....then copy and paste into result.txt
any possible way to write a script to run it automatically?... (3 Replies)
Discussion started by: happyv
3 Replies
2. Shell Programming and Scripting
Hi,
I have about 12 columns and 15 rows to be retrived from sybase isql command through unix. But when i output the sql into a file and see it, the formatting is going for a toss. can someone please suggest how can i get the result correctly in the output file ?
Thanks,
Sateesh (2 Replies)
Discussion started by: kotasateesh
2 Replies
3. UNIX for Dummies Questions & Answers
Hi guys,
Is there a way a script can run an SQL statement and dump the results into a variable which can then be used later in the script?
Thanks. (3 Replies)
Discussion started by: hern14
3 Replies
4. Shell Programming and Scripting
Hi,
1st post...
Done a quick search for this so apologies if I've missed it.
Basically I want to output and and append several values generated by a csh script direct to an xls openoffice file, rather than send to txt file and then physically copy and paste to xls file.
Already I send... (4 Replies)
Discussion started by: scottyjock
4 Replies
5. Programming
I have SQL giving me output of disabled ids in the system every day.
I can send on email for this disabled user list.
But I want to send one email for every disabled user or for every row.
thank you for your help.
Kyle (2 Replies)
Discussion started by: s1a2m3
2 Replies
6. Shell Programming and Scripting
I am currently returning an sql result with a number value that I want to format as an amount. The sql runs smoothly on its own, but when run inside my ksh script an error is encountered:
ERROR at line 3:
ORA-01481: invalid number format model
My sql is --
select distinct
... (6 Replies)
Discussion started by: avillanueva
6 Replies
7. UNIX for Dummies Questions & Answers
Hi
im trying to assign the result of the db2 command to a variable inside a shell script...
: tab_cnt=`db2 "select count(*) from syscat.tables where tabname = 'ABC' and tabschema = 'MATT01'" |head -4|tail +4|cut -c 11`
: echo $tab_cnt
when i echo im getting a blank value.. im expecting... (1 Reply)
Discussion started by: matt01
1 Replies
8. Shell Programming and Scripting
This is my first time writing a script and Im having some trouble,
Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage
I tried grep
Obviosly that hasnt worked,
Any... (8 Replies)
Discussion started by: jay02
8 Replies
9. Shell Programming and Scripting
How to Get SQL query result to file in putty?
I have one SQL query and I want that query output to be redirected to the file.
uname -a
SunOS XXX 5.8 Generic_117350-58 sun4u sparc SUNW,Sun-Fire-480R
Please suggest. (7 Replies)
Discussion started by: pamu
7 Replies
10. Shell Programming and Scripting
hi ,
i have written below piece of code to meet the requirement but i am stuck in the logic here.
the requirement are:
1) to send the sql out put to email body with proper formatting.
2) if count_matching = Yes then mail should triggered with the subject line ... (10 Replies)
Discussion started by: itzkashi
10 Replies
LEARN ABOUT DEBIAN
sxid.conf
SXID.CONF(5) File Formats Manual SXID.CONF(5)
NAME
sxid.conf - configuration settings for sxid
DESCRIPTION
This is the configuration file used by sxid to define it's parameters for execution. By default it is /etc/sxid.conf but can be anything
using the --config command line option for sxid. Options in this file are in the form of OPTION = "VALUE" . Note that the VALUE must be
contained in double quotes.
OPTIONS
ALWAYS_NOTIFY
If sxid does not find any changes it will not send an email unless you specify "yes" here.
ALWAYS_ROTATE
Usually sxid will only rotate the log files when there is a change from the last run. This is usually best, since all logs will
record a change rather than just a run of the program. If you want to rotate the logs every time sxid is run, regardless of changes,
specify "yes" here.
EMAIL Where to send the email containing the output of changes every time sxid is run. Example:
EMAIL = "Great Admin <root@host.com>"
ENFORCE
Normally sxid only flags items which are suid or sgid and are in a FORBIDDEN directory. With this option set to "yes" sxid will
remove the s[ug]id bit(s) on any files or directories it finds in forbidden directories and report any changes in the email. Note
that directories listed in FORBIDDEN are searched regardless of whether or not they are listed in SEARCH. However, EXCLUDED options
still apply to directories that fall under them.
EXCLUDE
A space seperated list of directories to exclude from the search. Note that if a SEARCH path falls under an EXCLUDE path that it
will still be searched. This is useful for excluding whole directories and only specifying one. Example:
SEARCH = "/usr /usr/src/linux"
EXCLUDE = "/usr/src"
EXTRA_LIST
File that contains a list of (each on it's own line) of other files that sxid should monitor. This is useful for files that aren't
+s, but relate to system integrity (tcpd, inetd, apache...). Example:
EXTRA_LIST = "/etc/sxid.list"
FORBIDDEN
A space seperated list of directories that are not supposed to contain any suid or sgid items. Items which are suid or sgid in these
directories are flagged in the email seperately from the other listings whether there are other changes or not. Example:
FORBIDDEN = "/tmp /home"
IGNORE_DIRS
Ignore entries for directories in these paths. This means that only files will be recorded. You can effectively ignore all directory
entries by setting this to "/".
KEEP_LOGS
This is a numerical value for how many log files to keep when rotating.
LISTALL
Forces a list of all entries to be included in th output. Implies ALWAYS_NOTIFY.
LOG_FILE
The full path of where to store the log files. These will be rotated, each rotated log being suffixed with a digit. The directories
must already exist. This is usually /var/log/sxid.log. Rotated logs would look like /var/log/sxid.log.n where 'n' is the number in
the rotation. The current log has no suffix.
AIL_PROG
Mail program. This changes the default compiled in mailer for reports. You only need this if you have changed it's location and
don't want to recompile sxid.
SEARCH A space seperated list of directories to search. Sxid will use these as a starting point for it's searches. Example:
SEARCH = "/usr /bin /lib"
AUTHOR
Ben Collins <bcollins@debian.org>
REPORTING BUGS
Report bugs to current maintainer Timur Birsh <taem@linukz.org>.
SEE ALSO
sxid(1)
sXid 4.0.5 January 2002 SXID.CONF(5)