Exit status for ftp in CShell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Exit status for ftp in CShell
# 1  
Old 01-20-2010
Exit status for ftp in CShell

Is there a way in the following CShell code to have ftp give an exit status that can be retrieved to determine if it succeeded or failed?

Code:
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

Thanks for any help,
Paul Hudgens
Denver

Last edited by Scott; 01-20-2010 at 12:09 PM.. Reason: Added code tags
# 2  
Old 01-20-2010
You could redirect the stderr and check it after the operation:

Code:
ftp -n logxx.xxxx.xxx.xxx.com <<DO_FTP1 2>log.err
...
DO_FTP1
[ -s log.err ] || echo an error occurred ...

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to see the status of all the ftp put & get files logs and curent ftp transfer status ?

How to see the status of all the ftp put & get files logs and curent ftp transfer status if any active ftp running in the background ? (2 Replies)
Discussion started by: i4ismail
2 Replies

2. Shell Programming and Scripting

How to download recursively a folder using /usr/bin/ftp and cshell?

Hi, friends, I am meet a ftp download problem when using cshell and /usr/bin/ftp command. I want to download recursively a folder dira from FTP server. dira ---dira1-----dira2------dira3-----dira4 |--file11 |--file21 |--file31 |--file41 |--file12 |--file22 |--file32 ... (1 Reply)
Discussion started by: weichanghe2000
1 Replies

3. Shell Programming and Scripting

Want to get the exit status

Hi All, I am trying to create a zip file with all the txt files(these are in large number) in the current directory. I am able to do this operation sucessfully. After this i want to get the status of the tar command executed and do accordingly. When i am trying with the below code, the status... (3 Replies)
Discussion started by: paddu
3 Replies

4. Shell Programming and Scripting

Exit Status

I have a shell script (#!/bin/sh) that interacts with Appworx and Banner Admin. In my script I want to check the exit status of awrun before continuing. awrun can run for 10 seconds or it can run for over a minute. So my question is, will it go through my if statement before awrun may even be... (2 Replies)
Discussion started by: smkremer
2 Replies

5. Shell Programming and Scripting

problem in exit status of the command in a shell script-FTP

Hi All, I have developed below script for FTP a file from unix machine to another machine. ftpToABC () { USER='xyz' PASSWD='abc' echo "open xx.yy.zbx.aaa user $USER $PASSWD binary echo "put $1 abc.txt" >> /home/tmp/ftp.$$ echo "quit" >> /home/tmp/ftp.$$ ftp -ivn <... (3 Replies)
Discussion started by: RSC1985
3 Replies

6. Shell Programming and Scripting

How to track exit status of ftp automation

ftp automation code is ftp -v -n -i $host_name << EOF user $u_name $u_pass bi mput $tar_file bye EOF How to check whether the file is successfully transfered or not. Suppose the user name or password is provided wrongly then the code should track the error and ask the end user to enter... (2 Replies)
Discussion started by: Dip
2 Replies

7. Shell Programming and Scripting

Exit status

I'm preparing for exam and one of exams is to write own test command... I wonder if in unix is a command which just returns exit code you specify.. I know I can easily write a function like this: exStatus() { return $1 } -> my question is rather theoretical thank you! (9 Replies)
Discussion started by: MartyIX
9 Replies

8. Shell Programming and Scripting

How to get the exit status

Hi all, I'm running a program which return 1 upon success. But when encounters problem shell return 's '1' . How to differentiate between them the shell return value and script return value. Ex. function fn return '1' if executed successfully and '0' if failed. But when if shell encounters... (1 Reply)
Discussion started by: yhacks
1 Replies

9. Shell Programming and Scripting

Incorrect Exit Status Returned from FTP command - Help??

I am trying to perform some error handing within a Korn sheel script whilst FTPing a file from one server to another.. The exit status is correctly set to zero, if my script connects to the other server and sends the file.. However, if for whatever reason other than a timeout the script... (3 Replies)
Discussion started by: frustrated1
3 Replies

10. UNIX for Advanced & Expert Users

ftp exit status.

Does ftp from unix have an exit status. In the sense after ftp is invoked and if the ftp fails during file transfer does it exit out with a status other than 0. What is do right now is invoke ftp and right it to a log and then grep for 'File Transferred Sucessfully'. Is this the only way to do it... (1 Reply)
Discussion started by: oracle8
1 Replies
Login or Register to Ask a Question