<?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 Not receiving email when run through cron in linux server, but receiving when run manually.How do we in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/not-receiving-email-when-run-through-cron-in-linux-server-but/m-p/7022120#M55150</link>
    <description>&lt;P&gt;&lt;BR /&gt;Hi All,&lt;/P&gt;&lt;P&gt;We are running a shell script on linux using the root user.&lt;BR /&gt;The functionality of the shell script is to check whether the tomcat process is running on the linux server and send an email if it is running or not running.&lt;BR /&gt;mailx -s "subject" emailid &amp;lt; /dev/null is what is being used to send email.&lt;/P&gt;&lt;P&gt;The emailid above is taken from environment setting file&lt;/P&gt;&lt;P&gt;We are receiving the email when we run the script manually but not when it is run through crontab.&lt;/P&gt;&lt;P&gt;Went to /etc/crontab and have initialised the EMAILTO option to our email ids..&lt;BR /&gt;When we check the /var/mail/root file after the cron is run, we see the message that the "Recepients emails are not specfied "&lt;/P&gt;&lt;P&gt;Same is the case when we schedule through normal user. Please suggest the way forward..&lt;/P&gt;</description>
    <pubDate>Wed, 17 Oct 2018 07:35:28 GMT</pubDate>
    <dc:creator>surya_123</dc:creator>
    <dc:date>2018-10-17T07:35:28Z</dc:date>
    <item>
      <title>Not receiving email when run through cron in linux server, but receiving when run manually.How do we</title>
      <link>https://community.hpe.com/t5/operating-system-linux/not-receiving-email-when-run-through-cron-in-linux-server-but/m-p/7022120#M55150</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hi All,&lt;/P&gt;&lt;P&gt;We are running a shell script on linux using the root user.&lt;BR /&gt;The functionality of the shell script is to check whether the tomcat process is running on the linux server and send an email if it is running or not running.&lt;BR /&gt;mailx -s "subject" emailid &amp;lt; /dev/null is what is being used to send email.&lt;/P&gt;&lt;P&gt;The emailid above is taken from environment setting file&lt;/P&gt;&lt;P&gt;We are receiving the email when we run the script manually but not when it is run through crontab.&lt;/P&gt;&lt;P&gt;Went to /etc/crontab and have initialised the EMAILTO option to our email ids..&lt;BR /&gt;When we check the /var/mail/root file after the cron is run, we see the message that the "Recepients emails are not specfied "&lt;/P&gt;&lt;P&gt;Same is the case when we schedule through normal user. Please suggest the way forward..&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 07:35:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/not-receiving-email-when-run-through-cron-in-linux-server-but/m-p/7022120#M55150</guid>
      <dc:creator>surya_123</dc:creator>
      <dc:date>2018-10-17T07:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Not receiving email when run through cron in linux server, but receiving when run manually.How d</title>
      <link>https://community.hpe.com/t5/operating-system-linux/not-receiving-email-when-run-through-cron-in-linux-server-but/m-p/7022164#M55151</link>
      <description>&lt;P&gt;&amp;gt; mailx -s "subject" emailid &amp;lt; /dev/null is what is being used to send&lt;BR /&gt;&amp;gt; email.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; No, it's not.&amp;nbsp; What is the _actual_ command in the script?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; The emailid above is taken from environment setting file&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; You wish.&amp;nbsp; Which "environment setting file"?&amp;nbsp; How is it read?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Went to /etc/crontab and have initialised the EMAILTO option to our&lt;BR /&gt;&amp;gt; email ids..&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; What does that mean?&amp;nbsp; As usual, showing actual actions with their&lt;BR /&gt;actual results (error messages, ...) can be more helpful than vague&lt;BR /&gt;descriptions or interpretations.&amp;nbsp; What you actually did is much more&lt;BR /&gt;important than what you think it all means.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; A "cron" job runs in an environment different from that of an&lt;BR /&gt;interactive job.&amp;nbsp; You may believe that you're setting some environment&lt;BR /&gt;variable somewhere, but, without seeing any of your actual code, I'd&lt;BR /&gt;guess that your "cron" job sees none of it.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; When we check the /var/mail/root file after the cron is run, we see&lt;BR /&gt;&amp;gt; the message that the "Recepients emails are not specfied "&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Which would be consistent with that "emailid" not really being&lt;BR /&gt;defined.&amp;nbsp; For a good time, throw something like "echo emailid" into your&lt;BR /&gt;script, and see what its value really is when the script runs.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If there's a script-like file somewhere which defines some variable,&lt;BR /&gt;then you may need to read it explicitly in your "cron" script:&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp; /path/to/file&lt;/P&gt;</description>
      <pubDate>Wed, 17 Oct 2018 13:17:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/not-receiving-email-when-run-through-cron-in-linux-server-but/m-p/7022164#M55151</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2018-10-17T13:17:15Z</dc:date>
    </item>
  </channel>
</rss>

