Hello Asier,
* asier <[EMAIL PROTECTED]> [040831 11:54]:
> open -u user,password ip-address; cd log; put mylog; exit;
There is no output on stdout (the one you connected via the pipe) but
only on stderr (logging in; negotiation; putting and stuff).
> I have been trying unsuccessfully for a while now reading lftp's
> output with my application but all I get is nothing. I am running lftp
> 2.6.11.
#!/bin/bash
set -e
TARGET=cfengine
OUTPUT=`lftp -c "\
set dns:fatal-timeout 30;\
set net:timeout 30;\
set net:max-retries 1;\
set cmd:fail-exit true;\
open ${TARGET}; \
cls \
;" 2> /dev/null`
export LDIR='/home/cip/adm/sithglan/work/monitor-ftp/listings'
if [ -z "${OUTPUT}" ]; then
exit;
fi
echo "${OUTPUT}" > $LDIR/.$TARGET.listing
if cmp -s $LDIR/.$TARGET.listing $LDIR/$TARGET.listing; then
rm $LDIR/.$TARGET.listing
else
(diff -u $LDIR/$TARGET.listing $LDIR/.$TARGET.listing | egrep
'^[+-][^-]') || /bin/true
echo
mv $LDIR/.$TARGET.listing $LDIR/$TARGET.listing
fi
I attached this recipie because it has some good defaults for automated
lftp stuff. When a ftp site is down lftp would normally try forever to
connect to it, until it is killed. With this settings it gives up after
30 seconds or so.
Gruesse,
Thomas