<?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: error mailing file in script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152228#M157779</link>
    <description>I think you are mixing stdin/stdout of the loop and the program CLNUP. Why are you using exec to run this program? This terminates the current process.&lt;BR /&gt;&lt;BR /&gt;Use the following code:&lt;BR /&gt;&lt;BR /&gt;while read a b c&lt;BR /&gt;do&lt;BR /&gt;    if [ "${c}" -gt 1 ]&lt;BR /&gt;    then&lt;BR /&gt;        echo "${a}" &amp;gt;&amp;gt;output_file&lt;BR /&gt;        ${CLNUP} ${a} ${b}     fi&lt;BR /&gt;done &lt;INPUT_FILE&gt;&lt;/INPUT_FILE&gt;&lt;BR /&gt;if [ -s output_file ]&lt;BR /&gt;then&lt;BR /&gt;    mailx -s Subject ${MAILTO} &lt;OUTPUT_FILE&gt;&lt;/OUTPUT_FILE&gt;fi</description>
    <pubDate>Mon, 29 Dec 2003 03:51:28 GMT</pubDate>
    <dc:creator>Siem Korteweg</dc:creator>
    <dc:date>2003-12-29T03:51:28Z</dc:date>
    <item>
      <title>error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152219#M157770</link>
      <description>I have a #!/bin/sh script that performs a while loop and writes output to a file.&lt;BR /&gt;&lt;BR /&gt;After the while loop I have an if statement that checks if -s then mails file.&lt;BR /&gt;&lt;BR /&gt;Problem. If I run the script it does not send the email, the file exists but does not send the file.BUT, if I dont remove the file, and run it again, it emails it. Its like it does not see the file the first time.&lt;BR /&gt;&lt;BR /&gt;Do I have to close the file, after the while / done &lt;BR /&gt;&lt;BR /&gt;If so, how?</description>
      <pubDate>Wed, 24 Dec 2003 12:39:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152219#M157770</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2003-12-24T12:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152220#M157771</link>
      <description>Post the script please.&lt;BR /&gt;&lt;BR /&gt;How you are writing this is important.&lt;BR /&gt;&lt;BR /&gt;Your first write to the file should be &lt;BR /&gt;&lt;BR /&gt;output for example cat &amp;gt; filename&lt;BR /&gt;&lt;BR /&gt;Subsequent output &amp;gt;&amp;gt; filename&lt;BR /&gt;&lt;BR /&gt;The second statement appends.&lt;BR /&gt;&lt;BR /&gt;Every time your script finishes appending, the file is closed.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 24 Dec 2003 12:41:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152220#M157771</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-12-24T12:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152221#M157772</link>
      <description>while read POS CON NAME DATE TIME UPTIME&lt;BR /&gt;do&lt;BR /&gt;        if [ "$UPTIME" -gt 1 ];then&lt;BR /&gt;        #make a list of person, date and time resource removed&lt;BR /&gt;        echo $NAME,$DATE,$TIME &amp;gt;&amp;gt; $PUNTED&lt;BR /&gt;        exec $CLNUP "/pos:"$POS "/con:"$CON"\r"&lt;BR /&gt;        fi&lt;BR /&gt;done &amp;lt; $FORTH_DOWN&lt;BR /&gt;ll $PUNTED&lt;BR /&gt;&lt;BR /&gt;#if resources removed send email to admins&lt;BR /&gt;if [ -s $PUNTED ];then&lt;BR /&gt;echo "found someone to punt"&lt;BR /&gt;$MAIL -s "$SUBJECT" $MAILTO &amp;lt; $PUNTED&lt;BR /&gt;#        $MAIL -s "$SUBJECT" $MAILTOCELL &amp;lt;&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Dec 2003 12:43:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152221#M157772</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2003-12-24T12:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152222#M157773</link>
      <description>I have a perl script that I use to email reports that works great. Includes checks for file attachments that are 0 size.&lt;BR /&gt;&lt;BR /&gt;#Module used to send the email&lt;BR /&gt;use MIME::Lite;&lt;BR /&gt;&lt;BR /&gt;#Initialize variables&lt;BR /&gt;my $from = 'reports@dcu_opc_gw2.dupagecu.com';&lt;BR /&gt;my $reply = 'hmahmoud@dcu_opc_gw2.dupagecu.com';&lt;BR /&gt;my $subject = 'Automated Report';&lt;BR /&gt;&lt;BR /&gt; $testing = system("test -s $location");&lt;BR /&gt; if ($newfile =~ /rstagtb4.txt/) {&lt;BR /&gt;  $newfile =~ s/.txt/.doc/;&lt;BR /&gt;  }&lt;BR /&gt; if ($testing == 0) {&lt;BR /&gt;  if ($newfile =~ /stmtprts.txt/) {&lt;BR /&gt; $mime_msg = MIME::Lite-&amp;gt;new(  #setup email message&lt;BR /&gt;  From    =&amp;gt; $from,&lt;BR /&gt;  To  =&amp;gt; $to_address,&lt;BR /&gt;  CC =&amp;gt; $reply,&lt;BR /&gt;  "Reply-To"=&amp;gt; $reply,&lt;BR /&gt;  Subject =&amp;gt; "$newfile - $subject",&lt;BR /&gt;  Data =&amp;gt; $message1&lt;BR /&gt;  )&lt;BR /&gt;  or die "Error creating MIME body\n";&lt;BR /&gt; $mime_msg -&amp;gt; attach(   #setup file attachment&lt;BR /&gt;  Path  =&amp;gt; $location,&lt;BR /&gt;  Filename=&amp;gt; $newfile&lt;BR /&gt;  )&lt;BR /&gt;  or die "Error attaching file\n";&lt;BR /&gt; $mime_msg -&amp;gt; send or die "Error sending report\n";   #send email&lt;BR /&gt;  } &lt;BR /&gt;  else {&lt;BR /&gt; $mime_msg = MIME::Lite-&amp;gt;new(  #setup email message&lt;BR /&gt;  From    =&amp;gt; $from,&lt;BR /&gt;  To  =&amp;gt; $to_address,&lt;BR /&gt;  CC =&amp;gt; $reply,&lt;BR /&gt;  "Reply-To"=&amp;gt; $reply,&lt;BR /&gt;  Subject =&amp;gt; "$newfile - $subject",&lt;BR /&gt;  Data =&amp;gt; $message&lt;BR /&gt;  )&lt;BR /&gt;  or die "Error creating MIME body\n";&lt;BR /&gt; $mime_msg -&amp;gt; attach(   #setup file attachment&lt;BR /&gt;  Path  =&amp;gt; $location,&lt;BR /&gt;  Filename=&amp;gt; $newfile&lt;BR /&gt;  )&lt;BR /&gt;  or die "Error attaching file\n";&lt;BR /&gt; $mime_msg -&amp;gt; send or die "Error sending report\n";   #send email&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt; print "Report: $newfile, sent to $to_address\n";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Wed, 24 Dec 2003 12:58:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152222#M157773</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2003-12-24T12:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152223#M157774</link>
      <description>Find attached a number of ways of using mailx.&lt;BR /&gt;We use this extensively in our shop.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;dl</description>
      <pubDate>Fri, 26 Dec 2003 12:18:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152223#M157774</guid>
      <dc:creator>Dave La Mar</dc:creator>
      <dc:date>2003-12-26T12:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152224#M157775</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;this I found:&lt;BR /&gt;     MAIL  If this variable is set to the name of a mail file and&lt;BR /&gt;           the  MAILPATH    variable  is  not set, then the shell&lt;BR /&gt;           informs the user of arrival of mail in  the  specified&lt;BR /&gt;           file.&lt;BR /&gt;&lt;BR /&gt;what have you got in $MAIL?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Sat, 27 Dec 2003 05:58:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152224#M157775</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-27T05:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152225#M157776</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;can you post the output of the script?&lt;BR /&gt;&lt;BR /&gt;have fun,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Sat, 27 Dec 2003 06:00:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152225#M157776</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-27T06:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152226#M157777</link>
      <description>I have MAIL set to /usr/bin/mailx&lt;BR /&gt;&lt;BR /&gt;I do not get any output. The script runs with no errors. There is data in the file to send.&lt;BR /&gt;&lt;BR /&gt;If I put an ls right after the done of the while loop it does not find the file. Only after the script exits.</description>
      <pubDate>Sat, 27 Dec 2003 23:34:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152226#M157777</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2003-12-27T23:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152227#M157778</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;please use another variable than $MAIL to avoid confusion with system variables. My suggestion: $MAILBIN&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Sun, 28 Dec 2003 06:18:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152227#M157778</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-28T06:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152228#M157779</link>
      <description>I think you are mixing stdin/stdout of the loop and the program CLNUP. Why are you using exec to run this program? This terminates the current process.&lt;BR /&gt;&lt;BR /&gt;Use the following code:&lt;BR /&gt;&lt;BR /&gt;while read a b c&lt;BR /&gt;do&lt;BR /&gt;    if [ "${c}" -gt 1 ]&lt;BR /&gt;    then&lt;BR /&gt;        echo "${a}" &amp;gt;&amp;gt;output_file&lt;BR /&gt;        ${CLNUP} ${a} ${b}     fi&lt;BR /&gt;done &lt;INPUT_FILE&gt;&lt;/INPUT_FILE&gt;&lt;BR /&gt;if [ -s output_file ]&lt;BR /&gt;then&lt;BR /&gt;    mailx -s Subject ${MAILTO} &lt;OUTPUT_FILE&gt;&lt;/OUTPUT_FILE&gt;fi</description>
      <pubDate>Mon, 29 Dec 2003 03:51:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152228#M157779</guid>
      <dc:creator>Siem Korteweg</dc:creator>
      <dc:date>2003-12-29T03:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: error mailing file in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152229#M157780</link>
      <description>Greetins,&lt;BR /&gt;&lt;BR /&gt;First...mailx is a messaging/broadcast utility. And according to some in the threads below..doesn't support sending attachments. Might I suggest try using something like elm (a mail processing system).&lt;BR /&gt;&lt;BR /&gt;Here are a couple threads on sending attached files.  There are a few ways to do this..some like 'uuencode' or 'mpack'.  My personal favorite is the handy 'include' statement file, because of it's flexibility in sending any number of types of files...and getting them there the way you want.&lt;BR /&gt;&lt;BR /&gt;Here is even an old quickie script I wrote once for doing this..hope you find it useful !&lt;BR /&gt;==================&lt;BR /&gt;#!/bin/sh &lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;#  This little script runs a couple&lt;BR /&gt;#     Performance Programs for FileNet&lt;BR /&gt;#      and then setups and emails them&lt;BR /&gt;#        to user&lt;BR /&gt;#  Written 11/30/00 by Rita Workman&lt;BR /&gt;###########################################&lt;BR /&gt;#&lt;BR /&gt;#  Setup my only real variable&lt;BR /&gt;##############################&lt;BR /&gt;loc=/fnsw/local/tmp/perf&lt;BR /&gt;#&lt;BR /&gt;##############################&lt;BR /&gt;#  Now cleanup/move any old files &lt;BR /&gt;#    to ~/oldfiles for storage&lt;BR /&gt;#   And run their Perf Programs&lt;BR /&gt;###############################&lt;BR /&gt;cat /dev/null /home/rworkman/dummy/jmailer&lt;BR /&gt;cat /dev/null /home/rworkman/dummy/tmp&lt;BR /&gt;mv $loc/*.Z $loc/oldfiles&lt;BR /&gt;cd /fnsw/local/ps&lt;BR /&gt;/fnsw/local/ps/perfreports.hpu&lt;BR /&gt;cd /fnsw/lib/perf&lt;BR /&gt;/fnsw/lib/perf/getreports&lt;BR /&gt;compress $loc/*&lt;BR /&gt;#&lt;BR /&gt;################################&lt;BR /&gt;#  Setup Include file for email&lt;BR /&gt;################################&lt;BR /&gt;for mail in $loc/*&lt;BR /&gt; do&lt;BR /&gt;  print "[include $mail application/msword base64]" &amp;gt;&amp;gt; /home/rworkman/dummy/tmp 0&amp;gt;&amp;amp;1&lt;BR /&gt; done&lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;#&lt;BR /&gt;#   Email it !!&lt;BR /&gt;################################&lt;BR /&gt;elm -s "Daily Performance Files from Rita $(date)" user@dot.com &amp;lt; /home/rworkman/dummy/jmailer&lt;BR /&gt;#&lt;BR /&gt;echo "Email to user done $(date)" &lt;BR /&gt;#&lt;BR /&gt;#  all done !!&lt;BR /&gt;===========================&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/parseCurl.do?CURL=%2Fcm%2FQuestionAnswer%2F0%2C%2C0x41950559ff7cd4118fef0090279cd0f9%2C00.html&amp;amp;admit=716493758+1072703120567+28353475" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/parseCurl.do?CURL=%2Fcm%2FQuestionAnswer%2F0%2C%2C0x41950559ff7cd4118fef0090279cd0f9%2C00.html&amp;amp;admit=716493758+1072703120567+28353475&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/parseCurl.do?CURL=%2Fcm%2FQuestionAnswer%2F1%2C%2C0xd6a2afe90f1cd71190050090279cd0f9%2C00.html&amp;amp;admit=716493758+1072703480470+28353475" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/parseCurl.do?CURL=%2Fcm%2FQuestionAnswer%2F1%2C%2C0xd6a2afe90f1cd71190050090279cd0f9%2C00.html&amp;amp;admit=716493758+1072703480470+28353475&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Rgrds,&lt;BR /&gt;Rita&lt;BR /&gt;</description>
      <pubDate>Mon, 29 Dec 2003 08:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/error-mailing-file-in-script/m-p/3152229#M157780</guid>
      <dc:creator>Rita C Workman</dc:creator>
      <dc:date>2003-12-29T08:13:31Z</dc:date>
    </item>
  </channel>
</rss>

