![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Check FTP Status | april | Shell Programming and Scripting | 2 | 05-06-2009 09:04 AM |
| Script to check status of a PID | zeekblack | Shell Programming and Scripting | 14 | 10-03-2006 04:09 PM |
| Automated FTP to variable directory with error check | songtam | UNIX for Dummies Questions & Answers | 3 | 04-10-2006 10:57 AM |
| check the status and send an email with status | isingh786 | Shell Programming and Scripting | 3 | 12-29-2005 07:22 PM |
| Ftp Status Check | acheepi | Shell Programming and Scripting | 4 | 09-08-2005 04:23 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Status check of Automated FTP
Hi,
I've following code fragment as a part of 1 of my scripts. Function is supposed to perform automated ftp to designated host. Here are the details:- #! /usr/bin/ksh < some code> perform_ftp() { #Assume that file to transfer is available in current directory TMP_FILE=/tmp/$$-FTP echo " open <hostname>" > ${CMD_FILE} echo "user <user name> <password> " >> ${CMD_FILE} echo "put <some file> " >> ${CMD_FILE} echo "bye" >> ${CMD_FILE} ftp -vin < ${CMD_FILE} 1> /dev/null 2>>${ERROR_LOG} if [ $? -ne 0 ]; then echo "\nError Transmitting the file" rm -f ${CMD_FILE} exit 1 else echo "\nSuccessfully Transmitted report file." fi rm -f ${CMD_FILE} } The problem with above function is that even though the actual put command is not successful, say because file system is full or lack of appropriate permission, script will always report that file was transmitted successfully. This is because last command "bye" executed as a part of FTP is always successful & "$?" always returns 0. Any pointers how can I check whether "put" command was successful or not? P.S. :- Requirement is not to log output of ftp command in ERROR_LOG. It has to be discarded, no matter whether FTP is successful or not. } |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|