<?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: SFTP script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/sftp-script/m-p/3656110#M102479</link>
    <description>One more thing...&lt;BR /&gt;&lt;BR /&gt;You will need to enable an scp without password to make this script enabled. You can do this by generating authorized_keys in /.ssh folder.&lt;BR /&gt;&lt;BR /&gt;The above script will also store your error and log files in specific files. &lt;BR /&gt;&lt;BR /&gt;Wish you good luck&lt;BR /&gt;Regards,&lt;BR /&gt;Syam</description>
    <pubDate>Mon, 24 Oct 2005 10:45:22 GMT</pubDate>
    <dc:creator>Ranjith_5</dc:creator>
    <dc:date>2005-10-24T10:45:22Z</dc:date>
    <item>
      <title>SFTP script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script/m-p/3656108#M102477</link>
      <description>I want to write a customized sftp script. &lt;BR /&gt;1&amp;gt; Check for some particular files.. &lt;BR /&gt;2&amp;gt; IF file exists send check for destination ping/ssh. &lt;BR /&gt;3&amp;gt; Put file across to destination host. &lt;BR /&gt;4&amp;gt; Mail across result of success fail to a address.. &lt;BR /&gt;&lt;BR /&gt;Anyone has it in place? Or idea's, please send across.. &lt;BR /&gt;&lt;BR /&gt;Thanks and regards&lt;BR /&gt;Prashant</description>
      <pubDate>Mon, 24 Oct 2005 09:53:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script/m-p/3656108#M102477</guid>
      <dc:creator>Prashant Zanwar_4</dc:creator>
      <dc:date>2005-10-24T09:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: SFTP script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script/m-p/3656109#M102478</link>
      <description>Hi Prashant,&lt;BR /&gt;&lt;BR /&gt;Try the following script. Modify according to your servers / setup.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#! /usr/bin/ksh&lt;BR /&gt;cls&lt;BR /&gt;echo&lt;BR /&gt;echo&lt;BR /&gt;echo&lt;BR /&gt;echo "    SCRIPT TO SCP THE ARCHIVE LOGS TO DR     "&lt;BR /&gt;echo&lt;BR /&gt;echo&lt;BR /&gt;echo&lt;BR /&gt;echo "Enter the Starting Sequence Archive no to scp: \c"&lt;BR /&gt;read a&lt;BR /&gt;echo "Enter the Ending   Sequence Archive no to scp: \c"&lt;BR /&gt;read b&lt;BR /&gt;if [ \( `ls -lrt | grep -i $a | wc -l` = 1 \) -a \( `ls -lrt | grep -i $b | wc -l` = 1 \)  ]&lt;BR /&gt;then&lt;BR /&gt;echo&lt;BR /&gt;else&lt;BR /&gt;echo  "Uniqueness failed, recheck your file name and enter again"&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;reala=`ls -lrt | grep -i $a | awk '{print $9}'`&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "Confirm the file to scp is  $reala  type (y or n): \c"&lt;BR /&gt;read ans1&lt;BR /&gt;    if [ "$ans1" = "y" ]&lt;BR /&gt;    then&lt;BR /&gt;    echo&lt;BR /&gt;    echo "scp will be started from file $reala \n"&lt;BR /&gt;    echo&lt;BR /&gt;    else&lt;BR /&gt;    echo&lt;BR /&gt;    echo "scp is aborted becoz of wrong file name $reala \n"&lt;BR /&gt;    echo&lt;BR /&gt;    exit 1&lt;BR /&gt;    fi&lt;BR /&gt;else&lt;BR /&gt;echo "File with sequence $a doesn't exist \n"&lt;BR /&gt;fi&lt;BR /&gt;realb=`ls -lrt |grep -i $b | awk '{print $9}'`&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "Confirm the Ending file to scp is $realb type (y or n): \c"&lt;BR /&gt;read ans2&lt;BR /&gt;    if [ "$ans2" = "y" ]&lt;BR /&gt;    then&lt;BR /&gt;    echo&lt;BR /&gt;    echo "scp will be started up to the file $realb \n"&lt;BR /&gt;    echo&lt;BR /&gt;    else&lt;BR /&gt;    echo&lt;BR /&gt;    echo "scp is aborted becoz of wrong file name $realb \n"&lt;BR /&gt;    echo&lt;BR /&gt;    exit 2&lt;BR /&gt;    fi&lt;BR /&gt;else&lt;BR /&gt;echo&lt;BR /&gt;echo "File with sequence $b doesn't exist \n"&lt;BR /&gt;fi&lt;BR /&gt;reala1=`echo $reala | awk -F _ '{print $3}'|awk -F . '{print $1}'`&lt;BR /&gt;realb1=`echo $realb | awk -F _ '{print $3}'|awk -F . '{print $1}'`&lt;BR /&gt;while  [ $reala1 -le $realb1 ]&lt;BR /&gt;do&lt;BR /&gt;#       echo "present value is *$reala1* "&lt;BR /&gt;        scp  -p *$reala1* USERID@IP_OF_SERVER:/DIRECTORY_PATH&lt;BR /&gt;        if [ $? = 0 ]&lt;BR /&gt;        then&lt;BR /&gt;        echo "Completed the scp of file `ls *$reala1*` on `date`" &amp;gt;&amp;gt; /tmp/scplogs&lt;BR /&gt;        else&lt;BR /&gt;        echo "COULD NOT DO SCP TO DR on `date`  EITHER LINK IS DOWN / FILE SYSTEM IS FULL / DESTINATION INVALID " &amp;gt;&amp;gt; /tmp/scperror&lt;BR /&gt;        mailx -s SCP_FAILED_TO_DR_CHECK_LINK  EMAIL_ID &amp;lt; /tmp/scperror&lt;BR /&gt;        exit&lt;BR /&gt;        fi&lt;BR /&gt;        reala1=`expr $reala1 + 1 `&lt;BR /&gt;done&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;Syam</description>
      <pubDate>Mon, 24 Oct 2005 10:42:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script/m-p/3656109#M102478</guid>
      <dc:creator>Ranjith_5</dc:creator>
      <dc:date>2005-10-24T10:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: SFTP script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/sftp-script/m-p/3656110#M102479</link>
      <description>One more thing...&lt;BR /&gt;&lt;BR /&gt;You will need to enable an scp without password to make this script enabled. You can do this by generating authorized_keys in /.ssh folder.&lt;BR /&gt;&lt;BR /&gt;The above script will also store your error and log files in specific files. &lt;BR /&gt;&lt;BR /&gt;Wish you good luck&lt;BR /&gt;Regards,&lt;BR /&gt;Syam</description>
      <pubDate>Mon, 24 Oct 2005 10:45:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/sftp-script/m-p/3656110#M102479</guid>
      <dc:creator>Ranjith_5</dc:creator>
      <dc:date>2005-10-24T10:45:22Z</dc:date>
    </item>
  </channel>
</rss>

