<?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: sending a mail thru automatic ftp script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383225#M198016</link>
    <description>Why not send the entire result?&lt;BR /&gt;&lt;BR /&gt;I do something like this for rdist, could do the same for ftp:&lt;BR /&gt;&lt;BR /&gt;                ( su - prdadm -c "rdist -f $DRPDIR/distfile prdadm"; ) 2&amp;gt;&amp;amp;1 |\&lt;BR /&gt;                tee $DRPDIR/drp.log 2&amp;gt;&amp;amp;1 |\&lt;BR /&gt;                mailx -s "prdadm DRP rdist output" `cat /usr/local/ge/mailadmin.list`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
    <pubDate>Tue, 21 Sep 2004 08:47:16 GMT</pubDate>
    <dc:creator>Geoff Wild</dc:creator>
    <dc:date>2004-09-21T08:47:16Z</dc:date>
    <item>
      <title>sending a mail thru automatic ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383224#M198015</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have script that is doing ftp automatically.&lt;BR /&gt;My concern is once the file has been ftped I need to send a confirmation mail.&lt;BR /&gt;&lt;BR /&gt;if [ $? != 0 ]&lt;BR /&gt;then&lt;BR /&gt;        echo "Sorry error"&lt;BR /&gt;else&lt;BR /&gt;        echo "Working fine"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;But above checking is not working.&lt;BR /&gt;&lt;BR /&gt;Anybody recommend good method of doing this.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Vijay S&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Sep 2004 08:34:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383224#M198015</guid>
      <dc:creator>Vijayakumar  S</dc:creator>
      <dc:date>2004-09-21T08:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: sending a mail thru automatic ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383225#M198016</link>
      <description>Why not send the entire result?&lt;BR /&gt;&lt;BR /&gt;I do something like this for rdist, could do the same for ftp:&lt;BR /&gt;&lt;BR /&gt;                ( su - prdadm -c "rdist -f $DRPDIR/distfile prdadm"; ) 2&amp;gt;&amp;amp;1 |\&lt;BR /&gt;                tee $DRPDIR/drp.log 2&amp;gt;&amp;amp;1 |\&lt;BR /&gt;                mailx -s "prdadm DRP rdist output" `cat /usr/local/ge/mailadmin.list`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Tue, 21 Sep 2004 08:47:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383225#M198016</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-09-21T08:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: sending a mail thru automatic ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383226#M198017</link>
      <description>We can check file transfer success as,&lt;BR /&gt;&lt;BR /&gt; redirecting the ftp log to another file and check for the success and use the return there.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt; script /tmp/ftplog.log&lt;BR /&gt; ftp -i -n server &amp;lt; inputfile&lt;BR /&gt; exit&lt;BR /&gt;&lt;BR /&gt; # final exit&lt;BR /&gt; exit&lt;BR /&gt;&lt;BR /&gt; --inputfile --&lt;BR /&gt; user root test&lt;BR /&gt; get /tmp/testfile&lt;BR /&gt; bye&lt;BR /&gt; ---------------&lt;BR /&gt;&lt;BR /&gt; We have to grep the contents on /tmp/ftplog.log file.&lt;BR /&gt;&lt;BR /&gt;If you want to simply then come to rcp / scp then..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;rcp remotemachine:/tmp/testfile /tmp/.&lt;BR /&gt;if [ $? -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "Sorry error" | mail &amp;lt;...&amp;gt;&lt;BR /&gt;else&lt;BR /&gt;echo "Working fine" | mail &amp;lt;...&amp;gt;&lt;BR /&gt;fi &lt;BR /&gt; &lt;BR /&gt;You have to setup .rhosts file.&lt;BR /&gt;&lt;BR /&gt;To do more secure then go for scp there.</description>
      <pubDate>Tue, 21 Sep 2004 09:14:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383226#M198017</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-09-21T09:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: sending a mail thru automatic ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383227#M198018</link>
      <description>Hi Geoff,&lt;BR /&gt;&lt;BR /&gt;The Script is like this.  What happens if the ftp ip is changed what happnes to the script.  Mean the ftp IP has changed 10 days ago even though its not sending any mail that ftp has failed.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Vijay S&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;# This script is used to extract audit table info from AUD$ table and ftp to &lt;BR /&gt;# a central location. &lt;BR /&gt;# Server:  &lt;BR /&gt;# Username:  &lt;BR /&gt;# Password:  &lt;BR /&gt;# Please format your logs like:&lt;BR /&gt;# For OS: servername_os_yyyymmdd.log&lt;BR /&gt;# For DB: servername_dbx_yyyymmdd.log&lt;BR /&gt;# Where for the db the x is the instance. 1 for the first, 2 for the second.&lt;BR /&gt;&lt;BR /&gt;# Developed by:  &lt;BR /&gt;# e-mail:  &lt;BR /&gt;#          &lt;BR /&gt;&lt;BR /&gt;# Global env vars for this program&lt;BR /&gt;&lt;BR /&gt;# User Defined Paramters&lt;BR /&gt;export ORACLE_SID=$1&lt;BR /&gt;export USER=$2&lt;BR /&gt;export PSWD=$3&lt;BR /&gt;export AUDITHOME=$4&lt;BR /&gt;export ORACLE_HOME=$5&lt;BR /&gt;&lt;BR /&gt;NOTIFY= &lt;BR /&gt;NOTIFYONSUCCESS=0&lt;BR /&gt;AUDDATE=`date +%Y%m%d`&lt;BR /&gt;HOSTNM=`hostname`&lt;BR /&gt;FILENAME=${HOSTNM}_db_${ORACLE_SID}_${AUDDATE}.log&lt;BR /&gt;&lt;BR /&gt;# Set all Oracle variables to run sqlplus&lt;BR /&gt;# . $HOME/.profile&lt;BR /&gt;export PATH=$PATH:$ORACLE_HOME:$ORACLE_HOME/bin:$ORACLE_HOME/lib&lt;BR /&gt;export PATH=$PATH:.&lt;BR /&gt;export SHLIB_PATH=$ORACLE_HOME/lib:$SHLIB_PATH&lt;BR /&gt;export LIBPATH=$ORACLE_HOME/lib:$LIBPATH&lt;BR /&gt;export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH&lt;BR /&gt;&lt;BR /&gt;cd $AUDITHOME&lt;BR /&gt;&lt;BR /&gt;sqlplus $USER/$PSWD @${AUDITHOME}/scripts/getauditdata.sql ${AUDITHOME}/log/${FILENAME}&lt;BR /&gt;&lt;BR /&gt;if [ $? -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt;mailx -s "${ORACLE_SID} Audit Extract Failed" $NOTIFY &amp;lt; ${AUDITHOME}/log/${FILENAME}&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;if [ $NOTIFYONSUCCESS = 1 ]&lt;BR /&gt;then&lt;BR /&gt;mailx -s "${ORACLE_SID} Audit Extract Successful" $NOTIFY &amp;lt; /dev/null&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;ftp -v -n&amp;lt;&amp;lt; EOF&lt;BR /&gt;open  &lt;BR /&gt;user  &lt;BR /&gt;ascii&lt;BR /&gt;put ${AUDITHOME}/log/${FILENAME} ${FILENAME}&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# The code below doesn't work as expected. The above ftp command always &lt;BR /&gt;# returns with a code 0. Commenting this code for now &lt;BR /&gt;#if [ $? -ne 0 ]&lt;BR /&gt;#then&lt;BR /&gt;#echo 'removing log'&lt;BR /&gt;#rm ${AUDITHOME}/log/${FILENAME} ${FILENAME}&lt;BR /&gt;#exit 0&lt;BR /&gt;#fi;&lt;BR /&gt;# For now, I am assuming that the above ftp is always successful and&lt;BR /&gt;# removing the audit log&lt;BR /&gt;rm ${AUDITHOME}/log/${FILENAME} &lt;BR /&gt;</description>
      <pubDate>Tue, 21 Sep 2004 09:30:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383227#M198018</guid>
      <dc:creator>Vijayakumar  S</dc:creator>
      <dc:date>2004-09-21T09:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: sending a mail thru automatic ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383228#M198019</link>
      <description>We have something similar running, I set it up as follows:&lt;BR /&gt;echo '&lt;COMMAND&gt;&lt;BR /&gt;&lt;COMMAND&gt;&lt;BR /&gt;...&lt;BR /&gt;ls&lt;BR /&gt;quit' | ftp -i $srvr | grep '^-rw-' | grep $rem_nm &amp;gt;&amp;gt; $LOG&lt;BR /&gt;&lt;BR /&gt;if [ $? -eq 1 ]; then&lt;BR /&gt;  echo "Failed"&lt;BR /&gt;else&lt;BR /&gt;  echo "Succeed"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;The check on $? in the if looks at the status of the last grep command and not the ftp command.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Steven&lt;/COMMAND&gt;&lt;/COMMAND&gt;</description>
      <pubDate>Tue, 21 Sep 2004 22:35:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383228#M198019</guid>
      <dc:creator>Procnus</dc:creator>
      <dc:date>2004-09-21T22:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: sending a mail thru automatic ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383229#M198020</link>
      <description>We can manage ftp with hostname or FQDN for the ftp ip which is modified on 10 days there. Using hostname / Fully qualified domain name is always safe there.&lt;BR /&gt;&lt;BR /&gt;And use ftp script as&lt;BR /&gt;&lt;BR /&gt;ftp -v -n &lt;HOSTNAME or="" ip=""&gt; &amp;lt;&amp;lt; EOF | tee /tmp/ftplog.log&lt;BR /&gt;open&lt;BR /&gt;user&lt;BR /&gt;ascii&lt;BR /&gt;put ${AUDITHOME}/log/${FILENAME} ${FILENAME}&lt;BR /&gt;bye&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;Then audit the /tmp/ftplog.log file ${FILENAME} information's and success there. And ftp return return code will be always 0 because it is ending without any problem there. So return type check after ftp completion is not worth to this.&lt;/HOSTNAME&gt;</description>
      <pubDate>Tue, 21 Sep 2004 22:39:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383229#M198020</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-09-21T22:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: sending a mail thru automatic ftp script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383230#M198021</link>
      <description>Ftp for this requirement seems to be not adoptable. And file transfer using ftp is not fast / efficient at this point. I suggest you to use rcp (remote copy) It is very fast compared to other's and easy to handle. We can manage return type to handle the SUCCESS / FAILURE of file transfer.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;machine2  &amp;lt;--------&amp;gt;  machine1&lt;BR /&gt;$HOME/.rhosts   $HOME/.rhosts&lt;BR /&gt;machine1 user   machine2 user&lt;BR /&gt;&lt;BR /&gt;So that user can be accessible between machine1, machien2 without passwd. We can check success with return type 0 there.&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Sep 2004 22:45:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sending-a-mail-thru-automatic-ftp-script/m-p/3383230#M198021</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-09-21T22:45:54Z</dc:date>
    </item>
  </channel>
</rss>

