<?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: How to setup an email alert notification for failed SFTP jobs? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172260#M458293</link>
    <description>Thanks, James. I will try this, please wait.&lt;BR /&gt;&lt;BR /&gt;Jan</description>
    <pubDate>Tue, 28 Apr 2009 16:34:56 GMT</pubDate>
    <dc:creator>Jan Shu</dc:creator>
    <dc:date>2009-04-28T16:34:56Z</dc:date>
    <item>
      <title>How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172242#M458275</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;My DBA setup a sftp cron job to upload data to a remote sftp server. How to setup an email alert notification for failed SFTP jobs? so my DBA can resend the data transfer. Can you please help? Thank you.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 13:23:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172242#M458275</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T13:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172243#M458276</link>
      <description>Hi Jan:&lt;BR /&gt;&lt;BR /&gt;If you SFTP script returns zero for successs and non-zero for failure, then you simply do something like:&lt;BR /&gt;&lt;BR /&gt;# /home/jan/script || mailx -s "Failure in script" root &amp;lt; /dev/null&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 28 Apr 2009 13:38:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172243#M458276</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-28T13:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172244#M458277</link>
      <description>Dear James,&lt;BR /&gt;Thanks for the reply. I asked my DBA if her sftp script returns zero and non-zero for job status. DBA isn't sure, but she shows me the sftp log, it has only the verbes of the sftp connection. I think by default a script always return zero or non-zero for its result, right? Is there a way to test it?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 13:57:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172244#M458277</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T13:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172245#M458278</link>
      <description>sftp, like ftp, appears to always return a zero, provided there isn't an error in sftp itself.&lt;BR /&gt;&lt;BR /&gt;testing via the command line, and "echo $?" will show 0 regardless, you can prove this by trying to copy an non-existent file on the command line.  the "script" will have to be written such that it scans to output log or takes some other action to confirm the file transfered completely / successfully.  based on that action, the script should then return a zero or non-zero exit code.....</description>
      <pubDate>Tue, 28 Apr 2009 14:43:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172245#M458278</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-04-28T14:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172246#M458279</link>
      <description>Dear OldSchool,&lt;BR /&gt;&lt;BR /&gt;Thanks for the information. I will let my DBA test this. Please wait for my update soon. Thanks again.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 14:48:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172246#M458279</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T14:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172247#M458280</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;As OldSchool notes, the return value of (S)FTP isn't going to help.  You need to capture the session dialog in a file and parse it for success or failure.&lt;BR /&gt;&lt;BR /&gt;If, however, your (S)FTP script were written in Perl, the Perl module implementations allow simple tests like:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;$sftp-&amp;gt;put( $localfile, $remotefile );&lt;BR /&gt;if ( $sftp-&amp;gt;error ) {&lt;BR /&gt;    warn "Can't put '$localfile' -&amp;gt; '$remotefile': " . $sftp-&amp;gt;error . "\n";&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Apr 2009 15:02:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172247#M458280</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-28T15:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172248#M458281</link>
      <description>Dear James,&lt;BR /&gt;&lt;BR /&gt;I will check with my DBA if their sftp script is in Perl or not. I will search this forum website and hopefully I can find some sample sftp scripts in this forum website.&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 15:08:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172248#M458281</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T15:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172249#M458282</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;You could go as simple as this:&lt;BR /&gt;&lt;BR /&gt;If the sftp job fails send an email.&lt;BR /&gt;&lt;BR /&gt;If its a shell script.&lt;BR /&gt;&lt;BR /&gt;sftp or scp command ...&lt;BR /&gt;rc=$?&lt;BR /&gt;#This gets you the return code.&lt;BR /&gt;&lt;BR /&gt;if [ $rc -ne 0 ]&lt;BR /&gt;then&lt;BR /&gt;   echo "File transfer error" | mailx -s "subject" email@yuor.net&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 28 Apr 2009 15:43:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172249#M458282</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2009-04-28T15:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172250#M458283</link>
      <description>Dear Stephen,&lt;BR /&gt;&lt;BR /&gt;Thanks a lot, I will try this too. Please wait for my update.&lt;BR /&gt;&lt;BR /&gt;Have a nice day.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 15:49:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172250#M458283</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T15:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172251#M458284</link>
      <description>Hi (again) Jan:&lt;BR /&gt;&lt;BR /&gt;Re-read OldShool's post.  A simple return code from SFTP in a shell script is _not_ going to work:&lt;BR /&gt;&lt;BR /&gt;Consider:&lt;BR /&gt;&lt;BR /&gt;# cat ./mysh&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;sftp somehost &amp;lt;&amp;lt; EOF!&lt;BR /&gt;get /no/file /tmp/nofile&lt;BR /&gt;quit&lt;BR /&gt;EOF!&lt;BR /&gt;RC=$?&lt;BR /&gt;echo "rc=${RC}"&lt;BR /&gt;&lt;BR /&gt;# ./mysh&lt;BR /&gt;Connecting to somehost...&lt;BR /&gt;sftp&amp;gt; get /no/file /tmp/nofile&lt;BR /&gt;Couldn't stat remote file: No such file or directory&lt;BR /&gt;File "/no/file" not found.&lt;BR /&gt;sftp&amp;gt; quit&lt;BR /&gt;rc=0&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 28 Apr 2009 15:56:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172251#M458284</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-28T15:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172252#M458285</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;My DBA says their sftp script is a shell script not in Perl. If the return code won't work in the sftp shell script and I don't want to ask DBA to rewrite the script in Perl, what else should I try?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 16:07:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172252#M458285</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T16:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172253#M458286</link>
      <description>as noted previously:&lt;BR /&gt;&lt;BR /&gt;"the "script" will have to be written such that it scans to output log or takes some other action to confirm the file transfered completely / successfully. based on that action, the script should then return a zero or non-zero exit code....."&lt;BR /&gt;&lt;BR /&gt;In other words: somebody's going to have to write / rewrite something to make this work.</description>
      <pubDate>Tue, 28 Apr 2009 16:13:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172253#M458286</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-04-28T16:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172254#M458287</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;OldSchool wrote: "sftp, like ftp, appears to always return a zero, PROVIDED there isn't an error in sftp itself. &lt;BR /&gt;" So if there is an error, then it will return non-zero. And it should work for my sftp shell script to send failure alert notification.&lt;BR /&gt;&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 16:14:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172254#M458287</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T16:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172255#M458288</link>
      <description>Just got OldSchool's new update. Thanks.</description>
      <pubDate>Tue, 28 Apr 2009 16:18:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172255#M458288</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T16:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172256#M458289</link>
      <description>"So if there is an error, then it will return non-zero. And it should work for my sftp shell script to send failure alert notification"&lt;BR /&gt;&lt;BR /&gt;No..No.NO!&lt;BR /&gt;&lt;BR /&gt;sftp ALWAYS returns a zero, even if the commands fed to it fail.  the only time you would get a non-zero is if something caused "sftp" itself to fail, like no space in process table.&lt;BR /&gt;&lt;BR /&gt;Read and understand JRF's example. The transfer *FAILED* because of missing file, but the return code was 0 (indicating success)</description>
      <pubDate>Tue, 28 Apr 2009 16:22:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172256#M458289</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-04-28T16:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172257#M458290</link>
      <description>Hi (again) Jan:&lt;BR /&gt;&lt;BR /&gt;Here's a quick example of how you _might_ parse the SFTP session to determine success or failure:&lt;BR /&gt;&lt;BR /&gt;# cat ./mysftp&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset RC&lt;BR /&gt;typeset SFTPLOG=/tmp/sftplog.$$&lt;BR /&gt;trap 'rm ${SFTPLOG}' EXIT&lt;BR /&gt;exec 2&amp;gt;  ${SFTPLOG}&lt;BR /&gt;sftp smhadt1 &amp;lt;&amp;lt; EOF!&lt;BR /&gt;get /no/file /tmp/nofile&lt;BR /&gt;quit&lt;BR /&gt;EOF!&lt;BR /&gt;grep -iq "couldn't stat" ${SFTPLOG} &amp;amp;&amp;amp; RC=1 || RC=0&lt;BR /&gt;echo "rc=${RC}"&lt;BR /&gt;exit ${RC}&lt;BR /&gt;&lt;BR /&gt;...customize to your needs...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 28 Apr 2009 16:24:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172257#M458290</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-28T16:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172258#M458291</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;Thanks. Is this example a Perl script? Will it work with my DBA's shell script? e.g. I copy/paste the example commands to my DBA's script on a HPUX 11.23 Oracle 8i server?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 16:28:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172258#M458291</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T16:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172259#M458292</link>
      <description>Hi (again) Jan:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Is this example a Perl script?&lt;BR /&gt;&lt;BR /&gt;No, it is a SHELL script.  The '#!/usr/bin/sh' (first) line signals what interpreter to use --- the HP-UX Posix shell in this case.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Will it work with my DBA's shell script?&lt;BR /&gt;&lt;BR /&gt;You can certainly integregate and embellish the concept I presented.  I would make the hostname, the source and the target file names arguments to pass, too.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 28 Apr 2009 16:33:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172259#M458292</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-04-28T16:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172260#M458293</link>
      <description>Thanks, James. I will try this, please wait.&lt;BR /&gt;&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 16:34:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172260#M458293</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T16:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to setup an email alert notification for failed SFTP jobs?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172261#M458294</link>
      <description>Hi James/OldSchool/SEP,&lt;BR /&gt;&lt;BR /&gt;I got an idea. How about comparing the check sum of the data files before and after the sftp transfer? If they are the same, then the sftp upload is OK, if the check sum is different, then it is failed. What do you think?&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Jan</description>
      <pubDate>Tue, 28 Apr 2009 17:32:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-setup-an-email-alert-notification-for-failed-sftp-jobs/m-p/5172261#M458294</guid>
      <dc:creator>Jan Shu</dc:creator>
      <dc:date>2009-04-28T17:32:28Z</dc:date>
    </item>
  </channel>
</rss>

