On Sep 26, 2008, at 16:04, Berger, Josef wrote:
When put a nonexistent file (fttrant2) with lftp, the exit command
on the put command, works fine. The only problem is "$?" Return code
variable is 0 ?. Any ideas what is wrong, would be very appreciated.
ssh -v "$ZLINUX_USER"@"$ZLINUX_HOST" <<EOF_SSH
lftp -d -u myuser,mypassword IP_of_zLinux
lftp -c "set fail-exit true"
lftp -c "set ssl-allow false"
lftp -c "put -a fttrant2 || exit 1"
lftp -c "put -a fttrant1 || exit 1"
lftp -c "quit"
echo "lftp put return code="$?
EOF_SSH
Exit
Your commands don't seem to make any sense.
You are constantly re-executing lftp, giving it a single command,
afterwards lftp quits and then you repeat this procedure for the next
command.
Each time, lftp is starting anew with a blank, fresh state.
So most of your commands have no effect.
You set connection parameters but then lftp quits and forgets them
right away.
You set options but don't ask lftp to do anything else in that
session, so the options don't acutally apply to anything.
Your first attempt to put a file fails because it doesn't exist, just
like you wanted to test it.
put: /home/ftptest/fttrant2: No such file or directory
But as the second one shows, it fails even if the file did exist, as
lftp isn't connected to anything:
put: Not connected
It's probably easiest to put all your commands in a file, then use
lftp -f filename
to execute all your commands in a single session.
debug1: Authentication succeeded (password).
Most of your log entries, these debug lines, are coming as a result of
your ssh -v command.
Since your ssh connection seems to work fine, it'd be better to
disable ssh verbosity and concentrate on your actual issue. :)