The UNIX and Linux Forums  


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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sar Issue lbreddy SUN Solaris 2 01-28-2009 09:33 AM
HP-UX Issue!! Ham HP-UX 1 05-16-2008 11:18 PM
Unix Arithmatic operation issue , datatype issue thambi Shell Programming and Scripting 23 02-19-2008 07:19 AM
GUI issue ravi raj kumar UNIX for Advanced & Expert Users 1 02-18-2008 10:56 AM
An issue with SSH chakri.penguin UNIX for Advanced & Expert Users 1 11-09-2005 10:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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..
  #2 (permalink)  
Old 02-11-2009
stanleypane stanleypane is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 23
This script is written to use SFTP, but your test at the bottom shows that they don't have SFTP setup or it's on a different port than 22.

I'm betting they want standard FTP. Try using the ftp command to get to the host or telnet to port 21. If you get a response, then they are using standard FTP.

It looks like you'll have to rewrite your script to use FTP, but I would confirm that is the case before doing anything.
  #3 (permalink)  
Old 02-11-2009
Tuxidow Tuxidow is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 47
Yes i want solution for that... for ftp environment not sftp.. im getting a response with port 21..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0