Lftp default timeout and retry?












1















Where can I find the defaults for lftp? Eg net:max-retries and net:timeout.



I'm asking because I get some **** Data socket error (Connection timed out) - reconnecting message in my lftp debug log. And it seems to retry forever if I don't quit the process manually. Which is bad for cron jobs.



Questions:



How could I explicit set the timeout and retries for one special script, which is as follows:



lftp -c "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"


And how could I catch any sync errors in the batch file above, so that I could eg send an email notification on max timeouts?










share|improve this question























  • Are you by any chance looking for the --while-ok switch mentioned in the man page?

    – Elder Geek
    Feb 18 at 20:16
















1















Where can I find the defaults for lftp? Eg net:max-retries and net:timeout.



I'm asking because I get some **** Data socket error (Connection timed out) - reconnecting message in my lftp debug log. And it seems to retry forever if I don't quit the process manually. Which is bad for cron jobs.



Questions:



How could I explicit set the timeout and retries for one special script, which is as follows:



lftp -c "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"


And how could I catch any sync errors in the batch file above, so that I could eg send an email notification on max timeouts?










share|improve this question























  • Are you by any chance looking for the --while-ok switch mentioned in the man page?

    – Elder Geek
    Feb 18 at 20:16














1












1








1


1






Where can I find the defaults for lftp? Eg net:max-retries and net:timeout.



I'm asking because I get some **** Data socket error (Connection timed out) - reconnecting message in my lftp debug log. And it seems to retry forever if I don't quit the process manually. Which is bad for cron jobs.



Questions:



How could I explicit set the timeout and retries for one special script, which is as follows:



lftp -c "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"


And how could I catch any sync errors in the batch file above, so that I could eg send an email notification on max timeouts?










share|improve this question














Where can I find the defaults for lftp? Eg net:max-retries and net:timeout.



I'm asking because I get some **** Data socket error (Connection timed out) - reconnecting message in my lftp debug log. And it seems to retry forever if I don't quit the process manually. Which is bad for cron jobs.



Questions:



How could I explicit set the timeout and retries for one special script, which is as follows:



lftp -c "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"


And how could I catch any sync errors in the batch file above, so that I could eg send an email notification on max timeouts?







cron ftp






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 5 '18 at 9:39









membersoundmembersound

3011422




3011422













  • Are you by any chance looking for the --while-ok switch mentioned in the man page?

    – Elder Geek
    Feb 18 at 20:16



















  • Are you by any chance looking for the --while-ok switch mentioned in the man page?

    – Elder Geek
    Feb 18 at 20:16

















Are you by any chance looking for the --while-ok switch mentioned in the man page?

– Elder Geek
Feb 18 at 20:16





Are you by any chance looking for the --while-ok switch mentioned in the man page?

– Elder Geek
Feb 18 at 20:16










1 Answer
1






active

oldest

votes


















2














Still I don't know how to find out the defaults. But could change them as follows:



lftp -c "
set net:timeout 5;
set net:max-retries 3;
set net:reconnect-interval-multiplier 1;
set net:reconnect-interval-base 5;
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"





share|improve this answer



















  • 1





    try set -d to view default value of lftp variable. if net:max-retries is set to 0 means unlimited. 1 means no retries.

    – Lety
    Mar 5 '18 at 13:13











  • try echo $? lftp should return a value other then 0 in case of errors

    – Lety
    Mar 5 '18 at 14:29













  • Of course $? gives the exit code if lftp exists with error. BUT the problem here is that by default lftp tried to reconnect endless times by default. So the exitcode evaluation would never take place, as the code is never reached.

    – membersound
    Mar 5 '18 at 14:43











  • did you try set -d to view default value? I guess that max-retries is set to 0, this is why your command did not end. So, I think your answer is correct.

    – Lety
    Mar 5 '18 at 15:05











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1012006%2flftp-default-timeout-and-retry%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Still I don't know how to find out the defaults. But could change them as follows:



lftp -c "
set net:timeout 5;
set net:max-retries 3;
set net:reconnect-interval-multiplier 1;
set net:reconnect-interval-base 5;
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"





share|improve this answer



















  • 1





    try set -d to view default value of lftp variable. if net:max-retries is set to 0 means unlimited. 1 means no retries.

    – Lety
    Mar 5 '18 at 13:13











  • try echo $? lftp should return a value other then 0 in case of errors

    – Lety
    Mar 5 '18 at 14:29













  • Of course $? gives the exit code if lftp exists with error. BUT the problem here is that by default lftp tried to reconnect endless times by default. So the exitcode evaluation would never take place, as the code is never reached.

    – membersound
    Mar 5 '18 at 14:43











  • did you try set -d to view default value? I guess that max-retries is set to 0, this is why your command did not end. So, I think your answer is correct.

    – Lety
    Mar 5 '18 at 15:05
















2














Still I don't know how to find out the defaults. But could change them as follows:



lftp -c "
set net:timeout 5;
set net:max-retries 3;
set net:reconnect-interval-multiplier 1;
set net:reconnect-interval-base 5;
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"





share|improve this answer



















  • 1





    try set -d to view default value of lftp variable. if net:max-retries is set to 0 means unlimited. 1 means no retries.

    – Lety
    Mar 5 '18 at 13:13











  • try echo $? lftp should return a value other then 0 in case of errors

    – Lety
    Mar 5 '18 at 14:29













  • Of course $? gives the exit code if lftp exists with error. BUT the problem here is that by default lftp tried to reconnect endless times by default. So the exitcode evaluation would never take place, as the code is never reached.

    – membersound
    Mar 5 '18 at 14:43











  • did you try set -d to view default value? I guess that max-retries is set to 0, this is why your command did not end. So, I think your answer is correct.

    – Lety
    Mar 5 '18 at 15:05














2












2








2







Still I don't know how to find out the defaults. But could change them as follows:



lftp -c "
set net:timeout 5;
set net:max-retries 3;
set net:reconnect-interval-multiplier 1;
set net:reconnect-interval-base 5;
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"





share|improve this answer













Still I don't know how to find out the defaults. But could change them as follows:



lftp -c "
set net:timeout 5;
set net:max-retries 3;
set net:reconnect-interval-multiplier 1;
set net:reconnect-interval-base 5;
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose $FSOURCE $FTARGET
exit
"






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 5 '18 at 11:41









membersoundmembersound

3011422




3011422








  • 1





    try set -d to view default value of lftp variable. if net:max-retries is set to 0 means unlimited. 1 means no retries.

    – Lety
    Mar 5 '18 at 13:13











  • try echo $? lftp should return a value other then 0 in case of errors

    – Lety
    Mar 5 '18 at 14:29













  • Of course $? gives the exit code if lftp exists with error. BUT the problem here is that by default lftp tried to reconnect endless times by default. So the exitcode evaluation would never take place, as the code is never reached.

    – membersound
    Mar 5 '18 at 14:43











  • did you try set -d to view default value? I guess that max-retries is set to 0, this is why your command did not end. So, I think your answer is correct.

    – Lety
    Mar 5 '18 at 15:05














  • 1





    try set -d to view default value of lftp variable. if net:max-retries is set to 0 means unlimited. 1 means no retries.

    – Lety
    Mar 5 '18 at 13:13











  • try echo $? lftp should return a value other then 0 in case of errors

    – Lety
    Mar 5 '18 at 14:29













  • Of course $? gives the exit code if lftp exists with error. BUT the problem here is that by default lftp tried to reconnect endless times by default. So the exitcode evaluation would never take place, as the code is never reached.

    – membersound
    Mar 5 '18 at 14:43











  • did you try set -d to view default value? I guess that max-retries is set to 0, this is why your command did not end. So, I think your answer is correct.

    – Lety
    Mar 5 '18 at 15:05








1




1





try set -d to view default value of lftp variable. if net:max-retries is set to 0 means unlimited. 1 means no retries.

– Lety
Mar 5 '18 at 13:13





try set -d to view default value of lftp variable. if net:max-retries is set to 0 means unlimited. 1 means no retries.

– Lety
Mar 5 '18 at 13:13













try echo $? lftp should return a value other then 0 in case of errors

– Lety
Mar 5 '18 at 14:29







try echo $? lftp should return a value other then 0 in case of errors

– Lety
Mar 5 '18 at 14:29















Of course $? gives the exit code if lftp exists with error. BUT the problem here is that by default lftp tried to reconnect endless times by default. So the exitcode evaluation would never take place, as the code is never reached.

– membersound
Mar 5 '18 at 14:43





Of course $? gives the exit code if lftp exists with error. BUT the problem here is that by default lftp tried to reconnect endless times by default. So the exitcode evaluation would never take place, as the code is never reached.

– membersound
Mar 5 '18 at 14:43













did you try set -d to view default value? I guess that max-retries is set to 0, this is why your command did not end. So, I think your answer is correct.

– Lety
Mar 5 '18 at 15:05





did you try set -d to view default value? I guess that max-retries is set to 0, this is why your command did not end. So, I think your answer is correct.

– Lety
Mar 5 '18 at 15:05


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1012006%2flftp-default-timeout-and-retry%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕