<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Not sending mail when body is empty in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793118#M943695</link>
    <description>JRF....I was wondering...... ;~)&lt;BR /&gt;&lt;BR /&gt;I tried that and had fun watching my prompt not come back, then had to ctrl-C it twice.&lt;BR /&gt;&lt;BR /&gt;Note: Sometimes I really enjoy HP-UX's attempt at levity.&lt;BR /&gt;When I interrupted it first time it came back:&lt;BR /&gt;(Interrupt -- one more to kill letter)&lt;BR /&gt;&lt;BR /&gt;Then when I tested just what it would do in the original scenario it responded:&lt;BR /&gt;Null message body; hope that's ok&lt;BR /&gt;&lt;BR /&gt;Have a good weekend,&lt;BR /&gt;Jeff</description>
    <pubDate>Fri, 23 Aug 2002 20:33:28 GMT</pubDate>
    <dc:creator>Jeff Schussele</dc:creator>
    <dc:date>2002-08-23T20:33:28Z</dc:date>
    <item>
      <title>Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793114#M943691</link>
      <description>I remotely administer aprox 20 servers located all over the world. I have database log files I grep for a specific error message. I then pipe the output to mailx and mail it to the root aliases. I am learning perl, but in the meantime I need to get info from these files. My problem is: I don't want a mail message sent if there are no errors. Here is what I am currently doing.&lt;BR /&gt;&lt;BR /&gt;grep "SYSTEM ERROR" /backup/temp/travel.`date +'%b%d'`.lg | mailx -s "Log Errors at Lincoln" root&lt;BR /&gt;&lt;BR /&gt;Is there a way for mailx to not send the mail if the grep returns nothing? I know it will send mail with -s, but I need to know at a quick glance which server it came from. Any suggestions will be appreciated&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 20:09:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793114#M943691</guid>
      <dc:creator>John Peace</dc:creator>
      <dc:date>2002-08-23T20:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793115#M943692</link>
      <description>Hi John,&lt;BR /&gt;&lt;BR /&gt; Why don't you let the grep create (or not) the file. Then test (-f or -e) for the existence of it and whether it's 0 bytes (-s) or not before sending it to mailx?&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jeff</description>
      <pubDate>Fri, 23 Aug 2002 20:20:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793115#M943692</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2002-08-23T20:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793116#M943693</link>
      <description>Hi John:&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;# grep -q "SYSTEM ERROR" /backup/temp/travel.`date +'%b%d'`.lg || mailx -s "Log Errors at Lincoln" root &lt;BR /&gt;&lt;BR /&gt;Notice the quiet option ('-q') and the double pipe.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 20:21:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793116#M943693</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-23T20:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793117#M943694</link>
      <description>Hi (again) John:&lt;BR /&gt;&lt;BR /&gt;Oh, sorry, you *don't want to send the mail if 'grep' fails to match, so:&lt;BR /&gt;&lt;BR /&gt;# grep -q "SYSTEM ERROR" /backup/temp/travel.`date +'%b%d'`.lg &amp;amp;&amp;amp; mailx -s "Log Errors at Lincoln" root &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 20:25:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793117#M943694</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-23T20:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793118#M943695</link>
      <description>JRF....I was wondering...... ;~)&lt;BR /&gt;&lt;BR /&gt;I tried that and had fun watching my prompt not come back, then had to ctrl-C it twice.&lt;BR /&gt;&lt;BR /&gt;Note: Sometimes I really enjoy HP-UX's attempt at levity.&lt;BR /&gt;When I interrupted it first time it came back:&lt;BR /&gt;(Interrupt -- one more to kill letter)&lt;BR /&gt;&lt;BR /&gt;Then when I tested just what it would do in the original scenario it responded:&lt;BR /&gt;Null message body; hope that's ok&lt;BR /&gt;&lt;BR /&gt;Have a good weekend,&lt;BR /&gt;Jeff</description>
      <pubDate>Fri, 23 Aug 2002 20:33:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793118#M943695</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2002-08-23T20:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793119#M943696</link>
      <description>Jeff,&lt;BR /&gt;&lt;BR /&gt;I tried it also and had to interrupt it also. I already have it the way I wrote, but a mail message is sent with&lt;BR /&gt;&lt;BR /&gt;Null message body; hope that's ok &lt;BR /&gt;&lt;BR /&gt;As the text. So, I get a mail message whether I have an error or not. I want a mail message only when grep returns something. Can you post and example of what you were suggesting?&lt;BR /&gt;&lt;BR /&gt;TIA</description>
      <pubDate>Fri, 23 Aug 2002 20:54:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793119#M943696</guid>
      <dc:creator>John Peace</dc:creator>
      <dc:date>2002-08-23T20:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793120#M943697</link>
      <description>Hi (again) John:&lt;BR /&gt;&lt;BR /&gt;OK, its definitely Friday.  Try this.  It avoides the "dead letter" or "null body":&lt;BR /&gt;&lt;BR /&gt;# grep -q "SYSTEM ERROR" /backup/temp/travel.`date +'%b%d'`.lg &amp;amp;&amp;amp; mailx -s "Log Errors at Lincoln" root &amp;lt; /dev/null&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 21:10:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793120#M943697</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-23T21:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793121#M943698</link>
      <description>I see what is happening now. It sends me a blank email if grep finds something. Now how can I get it to send the output with it, but still nto send an email if there is not output?It would be nice if I could see the errors found. I could then decide which fires to put out first.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Fri, 23 Aug 2002 21:41:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793121#M943698</guid>
      <dc:creator>John Peace</dc:creator>
      <dc:date>2002-08-23T21:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793122#M943699</link>
      <description>Hi John:&lt;BR /&gt;&lt;BR /&gt;OK, do this to receive the output if it contains something of interest:&lt;BR /&gt;&lt;BR /&gt;# MYFILE=/backup/temp/travel.`date +'%b%d'`.lg &lt;BR /&gt;&lt;BR /&gt;# grep -q "SYSTEM ERROR" $MYFILE &amp;amp;&amp;amp; mailx -s "Log Errors at Lincoln" root &amp;lt; $MYFILE&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 21:57:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793122#M943699</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-23T21:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Not sending mail when body is empty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793123#M943700</link>
      <description>James,&lt;BR /&gt;&lt;BR /&gt;Thanks. With your help, here is what I am going to do.&lt;BR /&gt;&lt;BR /&gt;INFILE=/backup/temp/travel.`date +'%b%d'`.lg &lt;BR /&gt;OUTFILE=/tmp/errors.out&lt;BR /&gt;&lt;BR /&gt;grep "SYSTEM ERROR" $MYFILE &amp;gt; $OUTFILE &amp;amp;&amp;amp; mailx -s "Log Errors at Lincoln" root &amp;lt; $OUTFILE&lt;BR /&gt;&lt;BR /&gt;This will put the errors in the body of the email. Thanks again&lt;BR /&gt;&lt;BR /&gt;John  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 22:46:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/not-sending-mail-when-body-is-empty/m-p/2793123#M943700</guid>
      <dc:creator>John Peace</dc:creator>
      <dc:date>2002-08-23T22:46:00Z</dc:date>
    </item>
  </channel>
</rss>

