Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

ftp: Name or service not known

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-03-2011
Naga06 Naga06 is offline
Registered User
 
Join Date: May 2011
Last Activity: 24 January 2015, 12:53 PM EST
Location: Chennai
Posts: 50
Thanks: 11
Thanked 0 Times in 0 Posts
Hammer & Screwdriver ftp: Name or service not known

Hi All,

I'm a new user. When I try to use ftp in a script, its throwing the below error "ftp: Name or service not known".

what could be the issue??? Pls help.Linux
Sponsored Links
    #2  
Old Unix and Linux 05-03-2011
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 4 August 2015, 8:57 AM EDT
Location: NM
Posts: 10,508
Thanks: 348
Thanked 874 Times in 812 Posts
Please show us your script - the part with the problems.
Sponsored Links
    #3  
Old Unix and Linux 05-03-2011
Naga06 Naga06 is offline
Registered User
 
Join Date: May 2011
Last Activity: 24 January 2015, 12:53 PM EST
Location: Chennai
Posts: 50
Thanks: 11
Thanked 0 Times in 0 Posts
Halo jim mcnamara,

Pls find the script below.


Code:
HOST=XXXX
USER='USER'
PASSWD='PWD'
PATH=file/bak
ftp -n -i $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd $PATH
get file_name
bye
END_SCRIPT

Thanks in Advance....

Last edited by Franklin52; 05-04-2011 at 02:30 AM.. Reason: Please use code tags
    #4  
Old Unix and Linux 05-03-2011
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 4 August 2015, 8:57 AM EDT
Location: NM
Posts: 10,508
Thanks: 348
Thanked 874 Times in 812 Posts
1. can you ping your remote host

Code:
# XXXX is not the real hostname
ping XXXX

2. If #1 worked can you telnet to port 21 on the remote box?

Code:
telnet XXXX 21

IF you get something like this

Code:
Trying 10.128.3.251...
Connected to 10.128.3.251.
Escape character is '^]'.

it worked. Let us know.
The Following User Says Thank You to jim mcnamara For This Useful Post:
Naga06 (05-03-2011)
Sponsored Links
    #5  
Old Unix and Linux 05-03-2011
Naga06 Naga06 is offline
Registered User
 
Join Date: May 2011
Last Activity: 24 January 2015, 12:53 PM EST
Location: Chennai
Posts: 50
Thanks: 11
Thanked 0 Times in 0 Posts
Thanks a lot for your quick revert.

The thing is, I'm able to ping/ ftp to HOST normally.

But inside the script, its not working.

Kindly Suggest.
Sponsored Links
    #6  
Old Unix and Linux 05-04-2011
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 22 June 2015, 6:47 PM EDT
Posts: 6,399
Thanks: 288
Thanked 675 Times in 644 Posts
$PATH is a reserved variable in Shell. Use another name for the variable!

By changing the value of $PATH you have stopped your script from being able to find "ftp" ... or for that matter any program which is not in "file/bak".
Sponsored Links
    #7  
Old Unix and Linux 05-04-2011
Naga06 Naga06 is offline
Registered User
 
Join Date: May 2011
Last Activity: 24 January 2015, 12:53 PM EST
Location: Chennai
Posts: 50
Thanks: 11
Thanked 0 Times in 0 Posts
Dear Methyl,

I changed the variable name and even then No Go......
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 07:54 PM.