Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hellow evry body
i send files by ftp using ksh script . The real Proplem is How to Know if the sent file sent OK or Not (As rcp command I was check ($?) to know the sent file correctly sent or not)?
thanks
esam
E S A M

I realy used this solution inside my script ; But How I decide the result (Found OR NotFound )To report in simply and readable Form to enduser .To invoke this The following was my way :
1- call ftp scrpt from a parent scrpt
2- redirect ALL ftp output to a file
3- put the file
4- run "ls" inside ftp & echo a messge conaining constant expr. to the output file
5- after ftp scrpt ends , the process reback to parent scrpt then I grep a line witch includes both constant "IS" and the sent file name because I noticed that when ls found file it prints the file name .
but I want more proffisional way
clearecho "enter date ..\c" ; read dte ; export dte
if [ $dte ] ; then
echo ".. SENDING ...\c"
# folowing line calls ftp scrpt i named it SEND
/home2/flexuser/report/send >/home2/flexuser/report/send.log 2>&1
echo "Branches NOT sent "
echo "=================="
grep IS /home2/flexuser/report/send.log |grep -v txt|cut -f8 -d" "
echo ""
echo "Branches didnot respond "
echo "=================="
grep respond /home2/flexuser/report/send.log
echo ""
echo "Branches sent "
echo "=================="
grep IS /home2/flexuser/report/send.log |grep txt |cut -f14 -d" "
else
echo "input is not proper "
exit 1
fi
echo " Press Enter To exit ..\c"
read xx
###FTP SEND SCRIPT ###############
for host in `cat /home2/flexuser/.netrc |cut -f2 -d" "`
do
brn=`grep $host /home2/flexuser/.netrc |cut -f8 -d " "`ping $host 1 >/dev/null
case $? in
0)echo "\n Now you are sending $host";
ftp $host <<-ENDFTP
lcd /home2/flexuser/source
cd ATM_REP
put br_rp$dte.$brn br_rp$dte.$brn.txt
ls br_rp$dte.$brn.txt
!echo " IS The file br_rp$dte.$brn for $host Found ?\c"
bye
ENDFTP
;;
echo " No respond from $host" ;;" >> /home2/flexuser/report/send_rep/noconect ;
esac
done
E S A M

![]() |
how to map the j drive
|
Replace Word
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |