<?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: Finding scripts sending emails in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462915#M360189</link>
    <description>&lt;!--!*#--&gt;This is a common sysadmin problem. I solve it by replacing all email addresses in scripts with the name of the script itself, something like this:&lt;BR /&gt; &lt;BR /&gt;MYNAME=${0##*/}&lt;BR /&gt;MAILTO=$MYNAME&lt;BR /&gt;...&lt;BR /&gt;   echo "something to mail" | mailx -s "$MYNAME: someTitle" $MYNAME&lt;BR /&gt; &lt;BR /&gt;Assumming the script's name is abc.ksh, then the mailx line looks like this:&lt;BR /&gt; &lt;BR /&gt;   echo "something to mail" | mailx -s "$abc.ksh: someTitle" abc.ksh&lt;BR /&gt; &lt;BR /&gt;And in /etc/mail/aliases, I create an alias called abc.txt and set it to the distribution list. This now documents the name of the script in the subject and it allows me to change the distribution list without modifying the script at all.&lt;BR /&gt; &lt;BR /&gt;(scripting note: ${0##*} is the more efficient shell way to implement the basename command)</description>
    <pubDate>Mon, 20 Jul 2009 17:06:25 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2009-07-20T17:06:25Z</dc:date>
    <item>
      <title>Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462910#M360184</link>
      <description>I have a good number of email notifications in my sendmail logs sent "from" a particular user.&lt;BR /&gt;&lt;BR /&gt;Is there anyway I can find out which script or which programme does send that email in any one system ?&lt;BR /&gt;&lt;BR /&gt;I suspect most of these are automated entries like the ones in crontab/automated scripts.&lt;BR /&gt;&lt;BR /&gt;The idea is to pinpoint the scripts which send such emails.&lt;BR /&gt;&lt;BR /&gt;I just see the logs like below&lt;BR /&gt;&lt;BR /&gt;Jul 17 02:24:28 apple sendmail[15684]: [ID 801593 mail.info] n6H1ORS15682: to=&lt;USER.XYZ&gt;, delay=00:00:00, xdelay=00:00:00, mailer=direct, pri=175361, relay=server.department.dom.com [172.XXX.XXX.XXX], dsn=2.0.0, stat=Sent (n6H1OUZ20001 Message accepted for delivery)&lt;BR /&gt;Jul 17 02:24:01 apple sendmail[15287]: [ID 801593 mail.info] n6H1O1S15265: to=&lt;USER.XYZ&gt;, delay=00:00:00, xdelay=00:00:00, mailer=direct, pri=181633, relay=server.department.dom.com [172.XXX.XXX.XXX], dsn=2.0.0, stat=Sent (n6H1O3Z19526 Message accepted for delivery)&lt;BR /&gt;&lt;/USER.XYZ&gt;&lt;/USER.XYZ&gt;</description>
      <pubDate>Mon, 20 Jul 2009 10:09:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462910#M360184</guid>
      <dc:creator>iman_1</dc:creator>
      <dc:date>2009-07-20T10:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462911#M360185</link>
      <description>I don't see any good way to find them other than brute force.&lt;BR /&gt;From the message you can get a subject to do the search.&lt;BR /&gt;From crontab, you can look for scripts invoking mailx, mail or sendmail.</description>
      <pubDate>Mon, 20 Jul 2009 10:22:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462911#M360185</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-07-20T10:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462912#M360186</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;As Dennis said, a "brute" force search might be the fastest way.  &lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: From crontab, you can look for scripts invoking mailx, mail or sendmail.&lt;BR /&gt;&lt;BR /&gt;Yes, not only that but remember that any output (STDOUT or STDERR) from a crontask that isn't redirected to a file will generate mail to the initiating user.  Thus, you need to examine the user's crontab entries for this behavior, too.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 20 Jul 2009 10:48:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462912#M360186</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-20T10:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462913#M360187</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;There is no way from a sendmail log to know what script started the send.&lt;BR /&gt;&lt;BR /&gt;What you can do is get the exact start time and compare it to the cron schedule on the system and the keystroke logs of the users involved.&lt;BR /&gt;&lt;BR /&gt;You can get enough data to know what user sent the email, though a root cron job with a su - username 'command' can send as any user on the system.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 20 Jul 2009 10:52:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462913#M360187</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2009-07-20T10:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462914#M360188</link>
      <description>Thankyou guys, although i suspected the answer still wanted to have the confirmation of the "experts"&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Jul 2009 11:33:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462914#M360188</guid>
      <dc:creator>iman_1</dc:creator>
      <dc:date>2009-07-20T11:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462915#M360189</link>
      <description>&lt;!--!*#--&gt;This is a common sysadmin problem. I solve it by replacing all email addresses in scripts with the name of the script itself, something like this:&lt;BR /&gt; &lt;BR /&gt;MYNAME=${0##*/}&lt;BR /&gt;MAILTO=$MYNAME&lt;BR /&gt;...&lt;BR /&gt;   echo "something to mail" | mailx -s "$MYNAME: someTitle" $MYNAME&lt;BR /&gt; &lt;BR /&gt;Assumming the script's name is abc.ksh, then the mailx line looks like this:&lt;BR /&gt; &lt;BR /&gt;   echo "something to mail" | mailx -s "$abc.ksh: someTitle" abc.ksh&lt;BR /&gt; &lt;BR /&gt;And in /etc/mail/aliases, I create an alias called abc.txt and set it to the distribution list. This now documents the name of the script in the subject and it allows me to change the distribution list without modifying the script at all.&lt;BR /&gt; &lt;BR /&gt;(scripting note: ${0##*} is the more efficient shell way to implement the basename command)</description>
      <pubDate>Mon, 20 Jul 2009 17:06:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462915#M360189</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2009-07-20T17:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462916#M360190</link>
      <description>I use find in an instance like this (just did this morning in fact):&lt;BR /&gt;&lt;BR /&gt;find /startdir_where_script_are |xargs grep -l "the particular from user"&lt;BR /&gt;&lt;BR /&gt;If your scripts tend to be in just one or two locations, it's a relatively simple matter.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Mon, 20 Jul 2009 17:45:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462916#M360190</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2009-07-20T17:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462917#M360191</link>
      <description>On second thought, the fact that it's the "from user" might make that impossible.  It's easy enough to search for the "to user", though.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Mon, 20 Jul 2009 17:46:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462917#M360191</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2009-07-20T17:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462918#M360192</link>
      <description>&amp;gt;JRF: you need to examine the user's crontab entries for this behavior&lt;BR /&gt;&lt;BR /&gt;Yes and the mail you get tells you exactly that.  It is from root with the subject "cron".  And it lists the crontab command.</description>
      <pubDate>Tue, 21 Jul 2009 03:01:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462918#M360192</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-07-21T03:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462919#M360193</link>
      <description>Hi Iman,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1]Please go though the logs carefully.Which will give the details of from whom this mail is coming and to which id it is sending mail.&lt;BR /&gt;&lt;BR /&gt;2] I believe in this case "apple" user is sending mail.&lt;BR /&gt;&lt;BR /&gt;3]U can check /var/mail/"user" file.&lt;BR /&gt;&lt;BR /&gt;4] Once u get the details of users then check the cron details of that user using #crontab -l "username" |grep -i scriptname&lt;BR /&gt;&lt;BR /&gt;5]May be thease steps will help you out.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;&lt;BR /&gt;Yogesh</description>
      <pubDate>Tue, 21 Jul 2009 03:38:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462919#M360193</guid>
      <dc:creator>Yogesh M Puranik</dc:creator>
      <dc:date>2009-07-21T03:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Finding scripts sending emails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462920#M360194</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Dennis: JRF: you need to examine the user's crontab entries for this behavior&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Yes and the mail you get tells you exactly that. It is from root with the subject "cron". And it lists the crontab command.&lt;BR /&gt;&lt;BR /&gt;You missed my point.  I said that, "...any output (STDOUT or STDERR) from a crontask that isn't redirected to a file will generate mail to the initiating user."  It was this examination to which I referred; viz. un-redirected output.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 21 Jul 2009 10:36:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-scripts-sending-emails/m-p/4462920#M360194</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-21T10:36:35Z</dc:date>
    </item>
  </channel>
</rss>

