how to check ftp sucessful or not in shelscript [message #464397] |
Wed, 07 July 2010 14:46 |
lenin_babu55
Messages: 12 Registered: August 2007
|
Junior Member |
|
|
I wrote ftp script and registered it as a host program in oracle apps.I need to know whether the ftp successful or not for that i wrote like this but it always returns return code 0 and also it always returns COMPLETED NORMAL from front end although it has any errors.The errors are showing in log file
so i need to check whether the file ftped or not and also made COMPLTED ERROR if we have any errors
this is my code
# set -x
#!/bin/sh
file_path='/opt/grc/mvs/ERPDEV/outbound/us'
file='testfile.csv'
HOST='test123'
echo 'Transfer the following file: '$file
ftp -n $HOST <<END_SCRIPT
user lenin asdf
cd TESTLIB
lcd $file_path
asc
put $file
quit
END_SCRIPT
# Testing the status of FTP
rc=$?
if [ $rc = 0 ]
then
echo FTP Successful
else
echo FTP Failed
rc=1
fi
echo Return Code is $rc
date
Thanks,
Lenin
|
|
|
Re: how to check ftp sucessful or not in shelscript [message #464398 is a reply to message #464397] |
Wed, 07 July 2010 14:49 |
|
Michel Cadot
Messages: 68732 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
This question bears no real connection with Oracle.
Please find a more appropriate forum.
The topic is locked.
If I'm wrong, please, PM me (or report this message to a moderator, explain why you think it should be unlocked and it might be done).
Regards
Michel
|
|
|