The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: FTP Issue-Help
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-11-2009
Tuxidow Tuxidow is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 47
FTP Issue-Help

Hi all,
I am trying to transfer files from one server to another. Following is script i wrote for this purpose. It downloads the file to the server which the script is residing and uploads it to the remote server.

Main Script

Code:
#!/bin/bash -x

BOADIR=/ftp/nas1/csg/public/acct/fleet1/outbound
SNDIR=/ftp/nas1/csg/public/acct/austintet/inbound/
RAHULHOME=/home/rahul1
CSGDRPFLDR=/home/ftpora/export/temp
IP="192.168.191.130"
HOST="-i /root/.ssh/id_dsa_noauth 192.168.191.130"

##################################################
sleep 10
cd $BOADIR

su - rahul1 -c  "/usr/bin/scp -p rahul1@ssa001-fe:$CSGDRPFLDR/A900-STEEL* ."

sleep 2
cd $FLEETHOME

mv A900* $BOADIR

su - rahul1 -c "/usr/bin/ssh rahul1@ssa001-fe "cd $CSGDRPFLDR; /bin/rm -f $CSGDRPFLDR/A900-STEEL.test*""

sleep 1

FILES_TO_MOVE=/tmp/baofiles
cat /dev/null > $FILES_TO_MOVE

find $BOADIR -name "A900-STEEL*" -maxdepth 1 -type f > $FILES_TO_MOVE

if [ -s $FILES_TO_MOVE ]
then
./boa.sh
sleep 20
else
echo "No files to move"
exit 0
fi


script that calls ftp command using the expect function-./boa.sh


Code:
set timeout -1
spawn /usr/bin/sftp -b /ftp/nas1/csg/scripts/boaBatchFile tuxidow@ftpaccess.rahul.com
match_max 100000
expect -exact "Connecting to ftpaccess.rahul.com...\r
tuxidow@ftpaccess.rahul.com's password: "
send -- "625XHU14\r"
expect eof


The batch files which tells what to ftp-boaBatchFile


Code:
cd /NEARFAZE
mput /ftp/nas1/csg/public/acct/fleet1/outbound/A900-IRON*
quit

Bu this is not working fine as upon investigation I could find that customer is using ftp…not sftp to receive this file.

Following are the trials i did and the results got


Code:
root@xxxx03 scripts]# telnet ftpaccess.rahul.com 22

Trying 171.161.160.119...

 

[root@xxxx03 scripts]#

 

[root@xxxx03 scripts]# /usr/bin/sftp -b /ftp/nas1/csg/scripts/boaTestFile tuxidow@ftpaccess.rahul.com

Connecting to ftpaccess.rahul.com...


Can anyone suggest a method to troubleshoot this with out changing much of the script. if not possible any other alternatives??

Last edited by Tuxidow; 02-11-2009 at 08:49 AM..