I am trying to capture the bytes transferred in a ftp shell. It will be used to compare to the source file sent.
The shell will be used by MANY other shells and run on different days.
1. Run with nohup like:
nohup ./ftp.sh &
dest_bytes=""
But the Lftp works and the file was sent successfully
NO results in the $LFTP_LOG therefore cannot capture bytes transferred
2. run with without nohup like:
./calling.sh &
dest_bytes=20
Lftp works and the file was sent successfully
cat $LFTP_LOG
20 bytes transferred
Here are the shells scripts. Please note, the final shell will have much more code. Reduced for this purpose of showing the concept of what I am trying to accomplish.
**********
calling.sh
**********
#== Source the script so it is part of the main process==#
. ftp.sh ARG1 ARG2
echo "Back from ftp.sh with lftp_return = $lftp_return"
if (($lftp_return != 0))
then
echo "FAILED - exiting with $lftp_return"
else
echo "SUCCESS - exiting with $lftp_return"
fi
**********
ftp.sh
**********
** some arguments in the lftp come from NETRC. Code not included here
SRC_DIR=$1
FILE=$2
LFTP_LOG=${MYDIR}/${FILE}.log
lftp -e "open -u $USER,$PASSWD $DEST_MACHINE;cd $SRC_DIR;put ${FILE};bye" > $LFTP_LOG
lftp_return=$?;export lftp_return
dest_bytes=`cat $LFTP_LOG | cut -f1 -d' '`
The shell will be used by MANY other shells and run on different days.
1. Run with nohup like:
nohup ./ftp.sh &
dest_bytes=""
But the Lftp works and the file was sent successfully
NO results in the $LFTP_LOG therefore cannot capture bytes transferred
2. run with without nohup like:
./calling.sh &
dest_bytes=20
Lftp works and the file was sent successfully
cat $LFTP_LOG
20 bytes transferred
Here are the shells scripts. Please note, the final shell will have much more code. Reduced for this purpose of showing the concept of what I am trying to accomplish.
**********
calling.sh
**********
#== Source the script so it is part of the main process==#
. ftp.sh ARG1 ARG2
echo "Back from ftp.sh with lftp_return = $lftp_return"
if (($lftp_return != 0))
then
echo "FAILED - exiting with $lftp_return"
else
echo "SUCCESS - exiting with $lftp_return"
fi
**********
ftp.sh
**********
** some arguments in the lftp come from NETRC. Code not included here
SRC_DIR=$1
FILE=$2
LFTP_LOG=${MYDIR}/${FILE}.log
lftp -e "open -u $USER,$PASSWD $DEST_MACHINE;cd $SRC_DIR;put ${FILE};bye" > $LFTP_LOG
lftp_return=$?;export lftp_return
dest_bytes=`cat $LFTP_LOG | cut -f1 -d' '`