FTP failure with different scenario


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP failure with different scenario
# 1  
Old 03-22-2012
FTP failure with different scenario

Hi Gurus

the below FTP code works fine, but the issue is from past 1 week couldn't able to send the files to external system.
Code:
#--------------------------------------------------------------------#
#Start the ftp session
#--------------------------------------------------------------------#
#!/bin/sh
ftp -inv host_name << -END- > log_name
close
-END-

if cat log_name | grep -Ei 'not timed out refused' > /dev/null
then
   cat log_name
   rm -f log_name
   exit 1
   echo 'FTP connection failed'
else
	ftp -inv host_name << -END-   > log_name
	user user_name password
	cd $RFOLDER
	put $FOLDER/$FILE.sql.Z $FILE.sql.Z
	quit
	-END-

	if cat log_name|  grep -v bytes | awk '{print $1}' | grep -Ei '530
        425  426 450 451 452 500 501 503 504 530 532 550 551 552 553	421 ' > /dev/null
	then
	  cat log_name
	  rm -f log_name
	  exit 1
	  echo 'FTP failed'
	else
	  cat log_name
	  rm -f log_name
	  exit 0
	  echo 'FTP was successful'
	fi
fi

exit 0;

issue is :-

username was decommissioned and updated the new username but one of our support team accidently updated the old one.

my question is why the FTP code didn't raise the failed FTPed error and what will be the scenrios .

Please provide the solution for this

Thanks in Advance

---------- Post updated at 02:51 PM ---------- Previous update was at 11:14 AM ----------

any help in this....

error log from autosys says

ftp: Name or service not known
ftp: Name or service not known

error log from script says
Not Connected

do we have any code's for the above error.

please share the information

Last edited by SeenuGuddu; 03-22-2012 at 03:55 AM.. Reason: added the error codes
# 2  
Old 03-22-2012
Automated FTP scripts usually rely on the remote machines account credentials being available in the file .netrc in the home directory of the user under which the command is running. Google for ".netrc"

If the ftp is failing perhaps .netrc does not have the correct credentials for ftp automation.

As for why the script didn't detect the ftp failure I'm not sure.
# 3  
Old 03-22-2012
Quote:
Originally Posted by hicksd8
Automated FTP scripts usually rely on the remote machines account credentials being available in the file .netrc in the home directory of the user under which the command is running. Google for ".netrc"

If the ftp is failing perhaps .netrc does not have the correct credentials for ftp automation.

As for why the script didn't detect the ftp failure I'm not sure.
Thanks hicksd8,they have updated the username and seems that working fine.

there are asking why it didn't trap the error.

do we have anything to get ride of the error(unexpected errors) or any code changes will be helpful.Please share the information

Last edited by SeenuGuddu; 03-22-2012 at 11:04 PM..
# 4  
Old 03-22-2012
First impression is that the egrep (or grep -E) commands don't work because the "|" (the "or" operator) is totally missing.

Code:
echo "hello" | egrep "hello banana sausage"

<no answer>

echo "hello" | egrep "hello|banana|sausage"
hello


After another look. Hmm. What Shell is this? The script contains many errors. Please post what you want the script to achieve.

Last edited by methyl; 03-22-2012 at 05:56 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

FTP failure

Hi, We have a external vendor (outside firewall), who used to connect our ftp server till 2 days back. I am not able to figure out, what was changed. Now he is not able to login. When I login to ftp server (from inside firewall), I am able to connect with credentials. When that vendor login... (4 Replies)
Discussion started by: solaris_1977
4 Replies

2. Shell Programming and Scripting

Script to retry FTP commands if unsuccessful and capture the failure status code.

I am using the below code to ftp file onto another server FTP_LOG_FILE=${CURR_PRG_NAME}- ${FTP_FILE}-`date +%Y%m%d%H%M%S`.log ftp -ivn ${FTP_HOST} ${FTP_PORT} << ENDFTP >> ${EDI_LOG_DIR}/${FTP_LOG_FILE} 2>&1 user ${FTP_USER} ${FTP_PSWD} lcd... (2 Replies)
Discussion started by: akashdeepak
2 Replies

3. UNIX for Dummies Questions & Answers

boot up failure unix sco after power failure

hi power went out. next day unix sco wont boot up error code 303. any help appreciated as we are clueless. (11 Replies)
Discussion started by: fredthayer
11 Replies

4. Emergency UNIX and Linux Support

Help in below scenario

Hi, my file has the data like below: 11,231,ABCVAV 22,AAHJHAj22,hdsjkhdls 22,dhskjhdkshd 22,gdgkdkadh 11,232,dgsjgdjh 22,ghdskahdkja 22,shdkajshs 11,233,ddjs 22,dhjkahkd 22,hsajhaah 11,231,sjkjsjj 22,ahkh 22,hsakh From the above i need only the records which starts as 11,231... (5 Replies)
Discussion started by: pandeesh
5 Replies

5. IP Networking

FTP failure due to network problem

Hi, I've been searching through out this forum to find the exact message when during the on-going FTP, suddenly the network went down but i cannot find some. Could anyone provide me the exact return codes when FTP failed during FTP or prior to FTP the network went down and you still proceeded to... (3 Replies)
Discussion started by: vibora
3 Replies

6. Shell Programming and Scripting

Retry upon FTP failure

I am using the following code in a C Shell script to transfer files to a remote server: ftp -n logxx.xxxx.xxx.xxx.com <<DO_FTP1 quote user $user_name quote pass $password ascii put $js_file_name bin put $FinalZipFile quit DO_FTP1 This code works great except on those rare occasions... (8 Replies)
Discussion started by: phudgens
8 Replies

7. Ubuntu

ftp gateway scenario

I currently have Win 2003 setup with a server residing in the DMZ as a gateway forwarding ftp traffic via port 44000 to the ftp server behind the firewall. I want to setup the same with RedHat Linux. Need information on what software module would duplicate the above, and pass all ftp/sftp/ssl... (1 Reply)
Discussion started by: cdlvj
1 Replies

8. IP Networking

Automate FTP process and autorestart on link failure

Hi Guys, i have this lil challenge; i am to implement an automated script that searches/scans a directory for files then picks and sends this files to a very remote server via an ftp link. the challenge here is that the ftp link fails due to netwrk issues maybe; i therefore need to develop... (5 Replies)
Discussion started by: sdcoms
5 Replies

9. UNIX for Dummies Questions & Answers

failure writing network systems-ftp error

Hi, I tried to do a ftp get process from linux server to a remote system.It was giving an error 'failure writing network systems'.I am trying to ftp two files,one among them is successful and this problem occurs only if i run the code through 'cron' ie,manual run ends successfully. Would... (0 Replies)
Discussion started by: DILEEP410
0 Replies

10. Shell Programming and Scripting

Determining the failure or success of FTP

Hi there, I am in the process of writing a shell script to transfer files to a remote directory. Is there a method to determine the success or the failure of the ftp process. Regards Jim (4 Replies)
Discussion started by: JimJim
4 Replies
Login or Register to Ask a Question