Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Linux Shell script
hi everyone!i need help..i don't know how to fix errors in my script..i need to get and put data in other machine using ftp..please help me..thanks!
 

#!/bin/ksh
 
REMOTE='000.000.0.000'
USER='xxx'
PASSWORD='xxx'
 
source_dir='cd /usr/src'
target_dir='cd /usr/src'
 
ftp -n $REMOTE <<_FTP
quote USER $USER
quote PASS $PASSWORD
 
bin
lcd $source_dirpeed
cd $target_dir
 
put sample.txt
bye
_FTP
exit
 

 
error:
 
ftp: connect: Connection refused
Not connected.
Not connected.
Not connected.
Local directory now /root
Not connected.
Not connected.
Posted 24-Sep-12 20:32pm
aianne260
Comments
Richard MacCutchan at 25-Sep-12 4:52am
   
The first message you receive tells you that the server refused to accept an ftp connection request. You need to find out why.
aianne at 25-Sep-12 5:14am
   
thank you!i'll figure it out..
manoranjan at 25-Sep-12 5:10am
   
Usually, 'connection refused' error occurs if the server is not running. It can also occur if a firewall is blocking the connection. (but this is rare since f/w is usually configured to drop a packet). Check also whether TCP filter on network adaptor is enabled.
aianne at 25-Sep-12 5:15am
   
okay..thank you..i'll check my TCP and firewall..
manoranjan at 25-Sep-12 5:21am
   
Have you set REMOTE to correct IP (or hostname) and not '000.000.0.000'?
aianne at 25-Sep-12 5:24am
   
yeah..i set my remote correctly..i just put zeros for this post only..
aianne at 26-Sep-12 4:28am
   
is it right that the variable in remote is the ipaddress of the machine that im going to connect?and the lcd is my own directory while the cd is the directory of the other machine?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 300
2 Sergey Alexandrovich Kryukov 289
3 CPallini 235
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100