Search code examples
sftplftp

lftp mirror wrong return code


I am using lftp mirror -R to sync a local dir to a remote sftp dir

Just to get myself super clarified, the script my i am running lftp -f is as follows

open sftp://hostname port
user username password
mirror -R local_dir sftp_dir
exit

However I keep getting exit code 1 from mirror -R,even though from the standard stdout it seem that it has successfully uploaded the file and I can verify that the files are indeed upload from sftp.

So just wondering why is that happening and how i can get correct exit code


Solution

  • Non-zero exit code without error messages means that something has silently failed. Most often it is "chmod" operation. Try adding --no-perms option. To be sure, enable debug and see the interaction with the server.