Hello David,
the solution you thought of isn't a solution to your problem and doesn't
even fight the symptoms in a way you expect it. I run lftp myself a few
hundred times a day through a cronjob and the following works very well
for me to avoid temporary down times or network connectivity issues:
run_lftp()
{
[ -z "${TARGET}" ] && return;
[ -z "${OPERATION}" ] && return;
lftp <<EOF 2> /dev/null
# debug 3;
set dns:fatal-timeout 30;
set net:timeout 30;
set net:max-retries 1;
#set cmd:fail-exit true;
open ${TARGET};
${OPERATION};
EOF
}
If the target system is available, lftp simply gives up after approximately 30
seconds.
Thomas