Send an email or not, based on conditions

I want to send a unix script mail, on 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Hi,
Hjava wrote:
since I spooling the select to the file, does grep or cat the error only work on the firs time, you run the script?? for example
day one: run script , sql select find error, write to file and sent mail out.
day two run script , sql did not find error , suppose not send mail out , but the file keep first day's record , there for still send mail out.Well, no, it won't send any mail day two, since you by doing
date > $LOGFILEresets the logfile, i.e. it's the same as removing the logfile at script start.
If you want to keep the log files for historical or other reasons, I suggest including a date or day-of-week-part in the file name, for instance
LOGFILE=$BASEDIR/logfile_$(date +%F).logwhich today would give you a file name of logfile_2012-03-02.log
by the way is that a way to select from table one if status ='error' mail out select from table two if status ='error' mail out in one script??Well, what you will get in your log file is purely up to which selects you do in your script file. Or I misunderstood your question?
Brgds
Johan

Similar Messages

  • HT5312 I forget answers to security questions,on the other hand rescue email address that Apple use to send me email is not correst,how I can reset security questions or change rescue email ?

    I forget answers to security question , on the other hand rescue email address that Apple use to send me email is not correct , how I can reset security questions or change and make correction for rescue email address ?
    Please send me answer to [email protected] or [email protected]
    Thank you

    You need to contact Apple. Click here, phone them, and ask for the Account Security team.
    (87669)

  • TS3899 My ipad was working fine but if I go to send an email, a note pops up that my email address has been rejected by the server, what does that mean?

    Hi, my Ipad was working fine but if I try to send an email, a note pops up that my email address has been rejected by the server, what does this mean?  I am still receiving emails and can access websites through Safari.

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Using a POP account with multiple devices
    http://support.apple.com/kb/ht3228
    iOS: Adding an email account
    http://support.apple.com/kb/HT4810
    iOS: Setting up an Outlook.com, Hotmail, Live, or MSN email account
    http://support.apple.com/kb/ht1694
    iPhone, iPad, iPod touch: Microsoft Outlook 2003, Outlook 2007, Outlook 2010 may not display contacts and calendars after sync
    http://support.apple.com/kb/TS1944
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    How to Sync Contacts with Your iPad Using iTunes
    http://www.dummies.com/how-to/content/how-to-sync-contacts-with-your-ipad-using- itunes.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    iCloud: Create a group and add contacts to it
    http://support.apple.com/kb/PH2667
    eMail Groups - You can use a third party app that many users recommend.
    MailShot -  https://itunes.apple.com/us/app/mailshot-pro-group-email-done/id445996226?mt=8
    Group Email  -  https://itunes.apple.com/us/app/mailshot-pro-group-email-done/id445996226?mt=8
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Configuration problems with IMAP e-mail on iOS with a non-standard SSL port.
    http://colinrobbins.me/2013/02/09/configuration-problems-with-imap-e-mail-on-ios -with-a-non-standard-ssl-port/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • "send via email" STILL not working

    Hi community - I have seen this question asked several times but none of the answers given seem to apply to me.
    I am working in a Pages document. I want to send this document as a Word file to someone else. I go to the Share menu, click Word under the "send via email" header, and then...nothing happens. No email app opens, no error message appears, nothing.
    There are no slashes or unfamiliar characters in the file name. Both Gmail and the OS mail app are set up on my computer. What am I missing? I'm working on a brand new 13-inch MacBook Pro with a version of Pages just purchased from the app store.
    And please don't recommend just exporting it as a Word doc and then emailing the file - I know I can do that already, but the point is this very important feature isn't working.
    Thanks for the help - much appreciated!

    You would get the beep sound if you click on the greyed down "Send via Email". You have to choose which kind of document you want to send. But then again if it worked for you in the new account it can't be that giving you a problem.
    I once had a problem using  Pages. It worked fine in another user account but not in my original. Deleting the plist file didn't help, maintenace didn't help. Finally I uninstalled Pages/iWork 09 using Yvan's script from here. Then I installed my MacOS system (Snow Leopard) on top of what I had. Since the Snow Leopard system you can install a system again without erazing the hard disk. You might though check that anything important to you is saved on another disk or stick. Remeber to do the updates for the system
    I did the system updates and restarted the computer. Installed iWork. I have the iWork DVD. And I did the software updates too. Then Pages worked again!

  • Subject Line & Sender's Email Address Not Printing

    When using ePrint to print my emails, the sender's email address and the subject line do not print.  How can I get them to print?
    This question was solved.
    View Solution.

    Hi eldi,
    Thank you for the update.  
    If I knew how design engineers thought then I probably would have become one.
    You should be able to see who sent the email to the printer by logging into your HP ePrintCenter account or your HP Connected account (HP Connected has only been rolled out to the USA, the UK, France, and Germany).   Each account has a job/print history available.  If you are unsure who sent the job to the printer, you can always log into your account and check the email address the print job was sent from.   I’ve included a screen shot from each account and I've highlighted where you would find the email address that sent the print job.
    Regards,
    Happytohelp01
    Please click on the Thumbs Up on the right to say “Thanks” for helping!
    Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
    I work on behalf of HP

  • IMessage sending from email and not phone number.

    When I send an iMessage it sends from my email address rather than my phone number how can i change this to being sent from just my number as when people reply they are going to my email and not my iPhone??

    Go to your contacts and look up your own contact. To check if you have created an "I", which mean a "yourself" go to "Settings - Mail, Contacts, etc.". Under Contacts you will find "My Infos".
    At this point you should see your own name. If not, press on "My Infos" and create yourself on your iPhone. (Phone number, etc.). If you see your name at "My Infos" press on it an check if you have typed in your correct phone number.
    You can also go to Settings - Phone and look up if your number is saved under "My Number".
    I hope this will help you.

  • Text send to email address not being delivered

    Can anyone tell me why texts sent from my iphone 4 to my home email address are not being delivered? I like to send reminders of things I need to do from my phone to my email address. Have always been able to do this from other phones I've had but not now with this iphone 4. It saying they were sent but they never show up in my inbox or any other box.

    longlostname wrote:
    If my reply is being sent as an SMS, what is to prevent the new message from being sent as an SMS? 
    What prevents the new message being sent as an SMS is that your actually sending an email -- not an SMS, when you initiate a [email protected], that is an email, not an SMS.
    longlostname wrote:
    And are you aware of a way to send messages of any type to an email address from this model phone without having to have a data plan
    Nope, you don't have the data plan. Sorta like refusing to install a trailer hitch on your truck, and then wondering why you can't pull a trailer behind.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Need help in xml bursting email bodt contents based on condition

    Dear All,
    I have a requirement as below.
    I am developing a xml publisher report with bursting functionality, i need to set a email body based on some condition, so please help me out how i can set the email body dynamically in xml bursting file.
    Note:The email body may be huge. for ex:
    Dear ${LINE_MANAGER_POSITION},<br/><br/>
       The probationary period for ${FULL_NAME} holding Worker Number ${EMPLOYEE_NUMBER} will end on ${PROBATION_END_DATE}. Please be sure to assess the employee carefully and fill out the attached Probationary Period Report, sign it, and send it to your HR Business Partner ${HR_BP_EMP_NAME} before ${PROB_END_DATE_BEFORE}.  <br/><br/>
       Please note: <br/>
        <ul> <li> The maximum probationary period allowed by UAE labor law is six months starting from the Hire Date. Probation extensions beyond six months are not permitted.</li> </ul>
        <ul> <li> During the probationary period, the Employee has the right to end ${GENDER} employment contract with five working days notice period.</li> </ul>
        <ul> <li> According to UAE labor law, the Employee is considered a permanent Employee with limited or unlimited contract if ${A_HE_SHE} is not notified that ${A_HE_SHE} is not suitable for the position ${A_HE_SHE} is assigned to. Dubai Petroleum Establishment Human Resources Division will consider the probationary period to be successful if you do not complete and sign the Probationary Period Evaluation form for ${FULL_NAME} before ${PROB_END_DATE_BEFORE}.</li> </ul>
        <ul> <li> If the Employee passes the probationary period successfully and is subsequently deemed unsuitable for the assigned Position then the HR disciplinary process prevails.</li> </ul>
       For more information on the Employee probationary period process and assessment approaches, please <a href="_http://dullap01/livelink/livelink.exe/open/29695955"> click here </a> or contact your Human Resources Business Partner ${HR_BP_EMP_NAME} at <a>${HR_BP_EMAIL}</a><br/><br/><br/>
       Yours sincerely, <br/>
       Human Resources Division </font>
    Thnaks
    Deb

    logo's should be pulling are the logo's directly embedded in format template?
    Suggest you download and use the [Bursting Designer|http://bipublisher.blogspot.com/2009/09/bi-publisher-bursting-designer.html] and review the log file for errors. You will need to change your templates to point locally on your pc.
    Ike Wiggins
    http://bipublisher.blogspot.com

  • Certain features in Gmail, like chat and sending an email, are not working in normal mode.

    There seems to be some sort of problem with perhaps Flash/Java in Gmail, not sure. The chat box doesn't appear, and I can't send or reply to emails unless I'm in safe mode. It seems as though some add-on or feature is not working properly. This is a new issue, but didn't come about after downloading a newer version of Firefox. I am currently using 3.6.
    == URL of affected sites ==
    http://gmail.com

    Update flash to the latest version: http://support.mozilla.com/en-US/kb/Managing+the+Flash+plugin?s=update+flash&as=s#Updating_Flash

  • Can send icloud email but not receive

    I setup iCloud last night linked to my apple ID. Today I have created a new @me.com address in order to sync mail and notes.
    I can send e-mail from this address, but anything that gets sent to it just bounces back, like below from outlook.
    The e-mail account does not exist at the organization this message was sent to.
    Is there somethign I have missed?

    I have the same issue....it only affects my me.com email account that I setup to utilize iCloud.   I can receive email OK but get an error when sending,,,,,"The connection to the outgoing server p07-smtp.mail.me.com failed."
    I go to settings to check the smtp settings and it won't let me change them.
    Any thoughts?

  • Sending an email from notes with especific email account

    Hi! I have three different email accounts, and I want to send from the " notes" an email but from a specific account !
    How can I choose the email account? Tks

    Once the email opens, tap From: and selet the account you want.

  • Imessage sends from email account not phone number?

    There are 2 receiving options for messages (phone number and email account) but there doesn't appear to be a send option. All my imessages are sent from email not phone but sms from phone. Can this be changed?

    did you ever get this resolved?  I'm having the same issue...  I sometimes only provide an email address to people whom I wish to receive messages from so that they are not able to actually call my phone...  recently I've been hearing from friends who do have my phone number that all of a sudden my messages are being sent from my email address.  My 'start new message' option has ALWAYS been to send from my phone number.  I have always assumed that if someone started a conversation with me by sending to my imessage email address that when I respond to them and them only would it come from the email address...
    this has not been happening...

  • Macro - How to forward/send latest email only not including the whole email history?

    Hi Guys,
    How can I send or forward the latest email I received automatically without deleting the previous email history?
    Thank you!

    I really do not understand what you are trying to do.
    Chapter 12 of the user guide
    manuals.info.appleipod_touch-6.1-_user_guide.pdf
    http://manuals.info.apple.com/en_US/ipod_touch_user_guide.pdfexplans how to use the mail app.
    Just what are you trying to accomplish. It includes saying how to forward email,

  • Send to Email does not work in Yosemite iOS.

    In Safari trying to send page to mail recipient, when I click on share, send to mail, the Terminal program opens instead of the Mail. Also the Terminal Icon is displayed next to the Mail.  Looks like there is a glitch with program associations.  How can this be fixed?  Does Apple monitors this blog?

    Does Apple monitors this blog?
    No. Use this:
    http://www.apple.com/feedback/macosx.html

  • I forgot my security question answers. when i tell them to reset it, it sends an email, but not to my email address. can you send it to my primary email?

    topic ^^

    Nobody on these boards can. If you can't get into that email address, you need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    (100462)

Maybe you are looking for