Unix re-try sending ftp file

Cronjob for re-try sending ftp file

15,30,45,0 0-23 *  *  * /path_scr/FTPToArch_new.sh >> /path_scr/FTP2Arch.log 2>&1

##################################################
bash-3.2$ cat /path_scr/FTPToArch_new.sh

echo “**********Start********** `date`”
input_dir=/path_msc/NRT_BI
archive_dir=/path_msc/NRT_BKP
log=/path_scr/FTP2Arch.log
cd $input_dir
for file in `ls -1 *IDN89`
do
echo “File : $file”
echo $file > /path_scr/temp.list
sh /path_scr/scr_re-try.sh > /path_scr/temp.log
cat /path_scr/temp.log  >> /path_scr/FTP2Arch.log

file2Move=`cat /path_scr/temp.log | awk ‘{print $9}’ | grep IDN89 | sort -u |grep $file| wc -l`

if [ $file2Move -ge 1 ]
then
mv $file $archive_dir
echo “mv $file $archive_dir”
else
echo “No such File :” $file
fi
done
echo “**********End********** `date`”

##################################################
bash-3.2$ cat  /path_scr/scr_re-try.sh

input_dir=/path_msc/NRT_BI
for file in `cat /path_scr/temp.list`
do
ftp -n << END
open xxx.xxx.xxx.xxx
user xxxxxxxxxx xxxxxxxxxx
ascii
prompt
lcd $input_dir
mput $file
ls -ltr
bye
END
done

By hada79 Posted in Unix

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s