<?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: mailx and cron in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759298#M72034</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;thank you for your answers. Both were helpful. But the best was the hint to redirect the output of stderr to a temp file. There I saw my mistake. I gave cron a wrong location of my script. Now it is working.&lt;BR /&gt;&lt;BR /&gt;Dirk</description>
    <pubDate>Mon, 08 Jul 2002 13:37:06 GMT</pubDate>
    <dc:creator>Dirk Kilian</dc:creator>
    <dc:date>2002-07-08T13:37:06Z</dc:date>
    <item>
      <title>mailx and cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759295#M72031</link>
      <description>I testet mailx as a cron job to send the status of our backup tasks:&lt;BR /&gt;omnistat -previous -last 1 | mailx -s "Omnistat last day" &lt;MAIL-ADDRESS&gt;&lt;BR /&gt;-&amp;gt; this was working fine (I received the mail in my ofice)&lt;BR /&gt;&lt;BR /&gt;Now I'm trying to put it in a shell script, that I can send the status in error situations only. The script is working fine (I receive a mail), when I start the script manually. But from cron it is not working. Here is the script:&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;# **************************************&lt;BR /&gt;#&lt;BR /&gt;# Function: Check Omniback backup tasks and send a mail&lt;BR /&gt;#           in case of errors&lt;BR /&gt;#&lt;BR /&gt;# Author: D.Kilian&lt;BR /&gt;#&lt;BR /&gt;# Date:   2002/07/08&lt;BR /&gt;#&lt;BR /&gt;# **************************************&lt;BR /&gt;&lt;BR /&gt;mail_addr=dirk@nokia-ocd.com&lt;BR /&gt;temp_file=/tmp/omnistat.lst&lt;BR /&gt;&lt;BR /&gt;export mail_addr&lt;BR /&gt;export temp_file&lt;BR /&gt;&lt;BR /&gt;/opt/omni/bin/omnistat -previous -last 1 &amp;gt; ${temp_file}&lt;BR /&gt;&lt;BR /&gt;if [ `cat ${temp_file} | grep -E 'Failed | Errors' | wc -l` -gt 0 ]&lt;BR /&gt;then&lt;BR /&gt;        cat ${temp_file} | mailx -s "Backup Failure Omniback yesterday" ${mail_addr}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;rm ${temp_file}&lt;BR /&gt;*************************&lt;BR /&gt;So what's my mistake?&lt;BR /&gt;&lt;BR /&gt;Dirk&lt;/MAIL-ADDRESS&gt;</description>
      <pubDate>Mon, 08 Jul 2002 12:44:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759295#M72031</guid>
      <dc:creator>Dirk Kilian</dc:creator>
      <dc:date>2002-07-08T12:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: mailx and cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759296#M72032</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;You need to use the full path to your commands (cat, mailx, etc), or define your path:&lt;BR /&gt;&lt;BR /&gt;PATH=/usr/bin:/sbin:/usr/sbin&lt;BR /&gt;export PATH&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 08 Jul 2002 13:03:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759296#M72032</guid>
      <dc:creator>Christopher McCray_1</dc:creator>
      <dc:date>2002-07-08T13:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: mailx and cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759297#M72033</link>
      <description>Hi&lt;BR /&gt;Do you know if the job is started at all ?&lt;BR /&gt;If it is started, do you get any errors ? I am not quite sure how cronjob errors are handled but it is always possible to redirect stdout and stderr of your script to a temporary file.&lt;BR /&gt;&lt;BR /&gt;Which version of OmniBack do you use, there are perhaps easier ways to mail session status.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jul 2002 13:13:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759297#M72033</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2002-07-08T13:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: mailx and cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759298#M72034</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;thank you for your answers. Both were helpful. But the best was the hint to redirect the output of stderr to a temp file. There I saw my mistake. I gave cron a wrong location of my script. Now it is working.&lt;BR /&gt;&lt;BR /&gt;Dirk</description>
      <pubDate>Mon, 08 Jul 2002 13:37:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759298#M72034</guid>
      <dc:creator>Dirk Kilian</dc:creator>
      <dc:date>2002-07-08T13:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: mailx and cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759299#M72035</link>
      <description>Hi Dirk&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also in case you have croned the job any failures or the o/p message get mailed to root by default so you can also check the mail for the root bi eithe mail or vi /var/mail/root and check for the messges for that time in that file .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava</description>
      <pubDate>Mon, 08 Jul 2002 13:39:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mailx-and-cron/m-p/2759299#M72035</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2002-07-08T13:39:41Z</dc:date>
    </item>
  </channel>
</rss>

