Re: capturing a return code
- From: Bill Marcum <marcumbill@xxxxxxxxxxxxx>
- Date: Mon, 12 Nov 2007 09:12:48 -0500
On 2007-11-12, Jim Showalter <jshowalter@xxxxxxxxx> wrote:
I have a conundrum best explained by the following items:val=$?
Cut from "man ncftpget":
DIAGNOSTICS
ncftpget returns the following exit values:
0 Success.
-------------------------------=<(*)>=--------------------------------
Snippet from "bak_website" script:
echo "bak_website: Now archiving http://mywebsite.com"
ncftpget -RV -u user -p passwd ftp://mywebsite.com .
# move and list the archived files
val=$?
if [ $val -eq 0 ]; then
mvarc
# moves files from dir n to dir n+1
else
echo "bak_website failed"
fi
-------------------------------=<(*)>=--------------------------------
Message 44:
From droid@xxxxxxxxx Mon Nov 12 04:17:56 2007
X-Original-To: droid
Delivered-To: droid@xxxxxxxxx
From: droid@xxxxxxxxx
To: droid@xxxxxxxxx
Subject: Cron <droid@opus> /usr/local/bin/bak_website
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/droid>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=droid>
X-Cron-Env: <USER=droid>
Date: Mon, 12 Nov 2007 04:00:02 -0500 (EST)
bak_website: Now archiving http://mywebsite.com
ncftpget: server said: File successfully transferred
bak_website failed
-------------------------------=<(*)>=--------------------------------
On inspection I find the file was successfully transferred but mvarc
never executes. Shouldn't the message from the remote server set a
return code of zero? How can I capture ncftpget's return code?
echo "return code=$val"
You might try adding the -d option to ncftpget. It could be that one or
more files were transferred successfully but some were not, or the ftp
server is not a Unix server.
.
- Follow-Ups:
- Re: capturing a return code
- From: droid
- Re: capturing a return code
- References:
- capturing a return code
- From: Jim Showalter
- capturing a return code
- Prev by Date: Re: convert 8086 relocatable file to ascii text
- Next by Date: Re: convert 8086 relocatable file to ascii text
- Previous by thread: capturing a return code
- Next by thread: Re: capturing a return code
- Index(es):
Relevant Pages
|