Send an email or not, depending on the conditions

I want to send an email from unix script in the select condition
SET HEADING OFF
SET TRIMOUT OFF
SET SERVEROUTPUT OFF
SET ECHO OFF
SET FEEDBACK on
SET PAGESIZE 0
SET LINESIZE 120

SPOOL TOD_error_report.csv


count=select * from test2 where STATUS='ERROR'; 
if(count>)0
select * from test2 where STATUS='ERROR'; 

 fi
SPOOL OFF;
exit;
I want if the count >=0 , send email message out of the select 
send email message from

<<<<<<<<<<<<<<<< bat file is
cd /home/ajax/stu_roles
date > ~/stu_roles/log/stu_roles_bat.log
cat ~/result/.test_stat.pw | sqlplus [email protected] @DDT_role_report >> ~/stu_roles/log/stu_roles_bat.log

SUBJECT="Roles Report"
EMAIL_ADDR="[email protected]"

cat ~/stu_roles/DDT_role_report.csv | mailx -s "$SUBJECT" "$EMAIL_ADDR"

Edited by: Hjava on Mar 1, 2012 4:58 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

Hello

Hjava wrote:
Since I select it in the queue file, grep or cat the error only works on the firs time, you run the script? for example
first day: run the script, sql select find mistake, write to the file and sends the mail.
two day run the script, sql doesn't have not find the error, not assume email on, but the file keep track of the day before, he still send an email.

Well, no, it won't send any day two mail, since you by

date > $LOGFILE

Resets the log file, that is, it is the same as deleting the journal at the beginning of the script file.

If you want to keep logs for historical or other reasons, I suggest including a date or day-of-week-part in the file name, for example

LOGFILE=$BASEDIR/logfile_$(date +%F).log

that today would give you a file name of logfile_2012-03 - 02.log

is told in passing which is a way to select a table if status = select zip 'error' sending of two table if status = "error" mail in a script?

Well, what you will get in your log file is purely up to which selects you made in your script file. Or I misunderstood your question?

Brgds
Johan

Tags: Database

Similar Questions

  • Since the update, the sender's name does not appear on the email list.

    Sender's name does not appear in the preview screen, so I can't tell if it's legitimate or scam email. If I move to junk e-mail, it appears in the preview screen.

    I see the problem now. I can add the column and see the name of the senders. I had installed the Conversations Thunder module, which has a column between. This column is empty. I reinstalled the add-on. It works fine now.

    Thanks for your help.

  • When sending an Email containing pictures, I get the Message "one or more of the images could not be sent" in Windows Live Mail.

    When sending an Email containing pictures, I get the Message "one or more of the images could not be transmitted. When I send this message to my address, I see the little red X in place of the image. How can I fix it?

    original title: Live Mail

    Hi donabell,.

    Thanks for posting your question in the Microsoft answers Site Feedback forum. Your question it will be better answered by the experts in the Windows Live Solution Center. Please repost your question here.

  • Outlook Express 6 problem: send an email I get an error message and the email is not put in the sent items folder

    Outlook Express 6, Windows XP SP 3

    Problem: send an email, I get an error message and the email is not put in the sent items folder while the email (and attachments, if any) are successfully delivered to the recipient.

    The full error message is always useful, but I'm sure you have damaged dbx files.

    Spend most of your messages out of the Inbox and then create new folders to send and sent items box after having moved the messages you want to save to a local folder that you create.

    Tools | Options | Maintenance | Store folder will reveal the location of your Outlook Express files. Note the location and navigate on it in Explorer Windows or, copy and paste in start | Run.

    In Windows XP, Win2K & Win2K3 the OE user files (DBX and WAB) are by default marked as hidden. To view these files in Windows Explorer, you must enable Show hidden files and folders under start | Control Panel | Folder Options icon | Opinion, or in Windows Explorer. Tools | Folder options | View.

    With OE closed, find the DBX files for the items in the Outbox and sent and delete them.  New ones will be created automatically when you open OE.

    After you're done, followed by compacting your folders manually while working * off * and do it often.

    Click Outlook Express at the top of the the folder tree so no folders are open. Then: File | Work offline (or double-click on work online in the status bar). File | Folder | Compact all folders. Don't touch anything until the compacting is completed.

    General precautions for Outlook Express:

    Do not archive mail in the receipt or sent items box. Create your own user-defined folders and move messages you want to put in them. Empty the deleted items folder daily. Although the dbx files have a theoretical capacity of 2 GB, I recommend all a 300 MB max for less risk of corruption.

    Information on the maximum size of the .dbx files that are used by Outlook Express:
    http://support.Microsoft.com/?kbid=903095

    Disable analysis in your e-mail anti-virus program. It is a redundant layer of protection that devours the CPUs, slows down sending and receiving and causes a multitude of problems such as time-outs, account setting changes and has even been responsible for the loss of messages. Your up-to-date A / V program will continue to protect you sufficiently. For more information, see:
    http://www.oehelp.com/OETips.aspx#3

    Why you don't need your anti-virus to scan your email
    http://thundercloud.NET/infoave/tutorials/email-scanning/index.htm

    Note that for some AV programs, it may be necessary to uninstall the program and reinstall in custom Mode and uncheck analysis when the option is the result of e-mail messages.

    Compact often as specified above.

    And backup often.

    Outlook Express Quick Backup (OEQB Freeware)
    http://www.oehelp.com/OEBackup/default.aspx

  • How do send you emails to not disclose receipents?

    Original title: Receipents undisclosed

    How do send you emails to not disclose receipents?  I get emails addressed to the receipents not to disclose, but I don't know how I can send emails the same way.

    Barbara Hall

    This means that the recipients were specified with the Bcc by sender, rather than by the Cc field.

    BCC = Blind Carbon Copier

    If you can't find Bcc let us know what is your e-mail program.

    Tricky

  • "@specTypeName @" placeholder for extensibility of the Email does not work for the master specifications

    Hi all

    • I installed E-mail Feature Pack 4.1 extensibility 6.2 PLM.
    • I use "GSMEmailFileBasedVariablesFormatPluginFactory" to send e-mail notifications when work flowing from one status to another.
    • I am successfully able to generate notifications by e-mail for all GSM specifications with the content specified by me except the master specifications.

    "@specTypeName @" placeholder for extensibility of the Email does not work for the specifications of the master.

    Can you please help me solve the problem?

    FYI,.

    ' @specTypeName @ ' placeholder works in all other GSM specifications.

    Thank you

    Nefertari

    For the resolution of this problem, please see the following knowledge base document:

    Document 2079386.1 - Notifications by email for the specifications of the master only lack the Type of specification field

    Thank you

    Stephen, Oracle Support

  • In Mac Mail the contents of my email does not appear on the right side in mac maila

    In Mac Mail the contents of my email does not appear on the right side as it should. I checked all the settings, anyone ever had this problem before and going to knowwhat?

    Please, back up all data. Rebuild the mailbox.

  • What type of eloqua email send should I use to send an email more than once to the same beneficiary?

    What type of eloqua email send should I use to send an email more than once to the same beneficiary?

    In the canvas on the box email, there is a parameter that must be checked in order to send the same e-mail several times for the same contact. Enable 'Allow emails to be retransmitted to previous winners' and you're ready.

  • Site sometimes takes support sessions, sometimes not, depending on the user

    I have something very strange happening with sessions. A particular Web site supports session variables - or NOT - depending on where the site is displayed from. However, a location that sees no sessions on this site will see other sites of ColdFusion sessions. Whether or not a particular location sees sessions does not depend on the question whether the computer is on a network. It depends not on either a PC or a Mac, or if cookies are enabled. I don't know what it depends.

    To resolve this problem, I need to tell the host support exactly what to do. My experience with them, it's that I have to support support.

    Here are the details.

    Platform: ColdFusion MX on Windows.

    The Web site does NOT support sessions if the visitor is:
    (1) using a PC with Windows XP on a network with cookies enabled (me and probably low level host tech support)
    (2) using a Mac that is not networked (my client at home)

    The site supports sessions if the visitor is:
    (1) using a PC with Windows, possibly network (my client at work and technical support no doubt high level host)).

    Note: My client doesn't know if its computer network. I didn't ask the host tech support if they were put in a network, but I guess they are. Whenever I spoke with tech support people at low altitude, they see that the sessions do not work. But then they spend the ticket until high level Tech (that I can't talk) who say the sessions are working properly.

    In any case, there is enough information to eliminate cookies, the networks and the PC vs. Mac as the determining factor here.

    I did a test system and put it on two sites: my customer site on CF MX (where don't work sessions sometimes) and another site on CF 8 (where the sessions still work).

    Site A) here is the test on the site where the sessions sometimes do not work.

    http://birdprecision.com/z-test-sessions-1.cfm

    Site B) here is the test on the site where the sessions still work.

    http://brilliantgreenmarketing.com/z-test-sessions-1.cfm

    Do you have any idea what's going on here? And what should I say host technical support, to fix?

    In any case, it would be useful that tell you what results you get for Site A and details on your platform. If enough people did so, the answer may emerge just from that.

    As for me, I am totally confused. I've never seen anything like this.

    Thank you!!!

    VeryHopeful wrote:
    > Mack, thank you for your answer, but I do not completely understand.
    >
    > 1) on Site A, why are they working sessions for some users and not others?

    You try to set cookies on the ".com" domain, which is not allowed.
    If the cookie is not 'stick' on the browser for a new session is created
    on the server for each request. Check if you have something like
    or in
    your code.

    > 2) for users who don't see sessions on Site A, why sessions work on Site
    > B ?

    Because b, you're not setting on the .com domain cookies.

    >
    (> 3) what should I say host for the Site A change on the server, so
    > sessions works for everyone on the Site as they do for Site B?

    Delete the code that sets the cookie on the .com domain.

    --
    Mack

  • Click on the email link to send that email does not work

    I used to be able to send a link from Firefox or click on an email address on a website. Firefox raise my email (Yahoo mail), but the link in the email is not in the body or if I clicked on an e-mail To: part of the enamel is not met. Please help, it was a very useful feature.

    On further analysis, I found that Gmail doesn't have this problem, so I do believe that it is a problem with Firefox. I work with Yahoo mail now to solve. Thanks anyway.

  • I open Thunderbird to find that my 3 accounts it has only the Inbox display. If I send an email may not find the box sent to save the Archives went and he

    I don't know that other files are not hidden behind the triangle. When I send an email from the troubled account, it cannot find the folder sent to save her and gives a message saying that there is no Inbox (trycreate) obviously I can't pick up my mail and it's my main account. I looked my IMAPmail folder on my c /: drive and the files seem to be there. There is nothing in them. I'd appreciate any help you would be so kind as to offer.

    Any idea that it was the problem of children? I said at the time, but I bet you just went to splash with each of them.

  • starting yesterday windows mail doesn't send mail and deleted emails are not going in the folder to delete first

    deleted emails disappear just - I checked the settings and they are not configured to automatically remove. When I try to send an e-mail, as they go to the Outbox and windows mail will not send not and gives all the details in the window box, its just empty. When you return to the Outbox of the body of the e-mail message was gone.

    You can have an email stuck, even if you don't see it.

    How to remove an Undeletable Message stuck in Windows Mail
    http://www.Vistax64.com/tutorials/62560-Windows-Mail-problems.html

    WMUtil
    http://www.oehelp.com/WMUtil/default.aspx

    Bruce Hagen MS - MVP [Mail]

  • Send an email from VBA Excel generates the message OK but I don't know how to tell thunderbird to "sendnow". How to structure the command?

    This is the code I use to access the command-line for thunderbird. What I send to Thunderbird the email which was built?

    Dim strCommand As String

    strCommand = "C:\Program Files\Mozilla Thunderbird\thunderbird"
    strCommand = strCommand & " -compose " & Chr$(34) & "mailto:" & strTo & "?"
    strCommand = strCommand & "subject=" & Chr$(34) & strSubject & Chr$(34) & "&"
    strCommand = strCommand & "body=" & Chr$(34) & strBody & Chr$(34)
    
    Call Shell(strCommand, vbNormalFocus)
    

    Automatic sending of mail is not supported. It is extremely difficult to get malware to spew spam with your email client if it does not have an automated shipping option.

    I suggest you use vbs > code SMTP to send your mail. If you use Google or Outlook.com e-mail sent using the SMTP server can be synchronized in the sent folder.

  • Windows Live Mail sent emails do not appear in the 'Sent items' folder

    original title: sent Mail not in the folder

    I've just set up Windows Live Mail on a new laptop using Windows 7 Outlook came not with my desktop software. Why don't emails I send appear in my folder "sent items"?

    Sorry to have troubled you - problem solved. To set up my new Windows Live Mail I thought I need to establish a Windows Live account, so I did. Is not familiar with the presentation of Windows Live Mail, I didn't know that there are two accounts on the left side and one has been expanded, the Windows Live Mail account. My Westnet email accounts has been listed but not developed. As soon as I expanded it here, he had the sent mail another folder which included my recently sent emails! Outside of embrrassed, glad it is resolved.

  • Some emails do not appear in the list of folders, I can only find them using search Messages

    As of yesterday, the new emails from a regular correspondent do not appear in the list of messages when I click on the Inbox. The only way I can access it is to use "Edition/search/search of Messages. They are still in the Inbox, they have not moved to another folder.
    Thunderbird version is 31.6.0.

    You view the files 'all '? This page could help.
    http://KB.mozillazine.org/Disappearing_mail

Maybe you are looking for