JTUNIXUSER
MIS
My FTP is working, but I wanted to add some checks in the script to be safe:
1) Check for empty file, I extract data from an ingres DB, then FTP that data. What kind of check can I add to validate I don't have a file with no data ?
2) FTP LOG ? I'm sure this is easy, but is there a standard you guys would suggest for maybe creating a FTP log so that it could be reviewed in the event that the file failed to transfer ?
Here is my FTP logic at the moment:
### Build Header Line
RECTOT=`cat $OUTF | wc -l | awk '{printf("%06d\n",$1)}'`
RECTOT= $RECTOT + 1
StartTime=`date +%Y%m%d%H%M`
echo $HEADERID$PLANTCODE$FILETYPE$RECTOT$StartTime"
" >> $OUTFTP
for line in `cat $OUTF`
do
PARTNUM=`echo "$line" | awk -F: '{print $2}'`
QTY=`echo "$line" | awk -F: '{printf("%06d\n", $3)}'`
echo $DETAILID$PARTNUM" "$DEPT" "$GROUP" "$OP$StartTime$SHIFT$QTY" "$USER >> $OUTFTP
done
### FTP of File
# ftp -n $FTP_HOST<<END_SCRIPT
# quote USER $FTP_USER
# quote PASS $FTP_PASSWD
# ascii
# cd dir1/subdir
# quote site blkzise=93
# quote site lrecl=93
# put $LOCAL_DIR/$XMT_FILE $REMOTE_DIR/$XMT_FILE
# quit
# END_SCRIPT
# EOF #
1) Check for empty file, I extract data from an ingres DB, then FTP that data. What kind of check can I add to validate I don't have a file with no data ?
2) FTP LOG ? I'm sure this is easy, but is there a standard you guys would suggest for maybe creating a FTP log so that it could be reviewed in the event that the file failed to transfer ?
Here is my FTP logic at the moment:
### Build Header Line
RECTOT=`cat $OUTF | wc -l | awk '{printf("%06d\n",$1)}'`
RECTOT= $RECTOT + 1
StartTime=`date +%Y%m%d%H%M`
echo $HEADERID$PLANTCODE$FILETYPE$RECTOT$StartTime"
" >> $OUTFTP
for line in `cat $OUTF`
do
PARTNUM=`echo "$line" | awk -F: '{print $2}'`
QTY=`echo "$line" | awk -F: '{printf("%06d\n", $3)}'`
echo $DETAILID$PARTNUM" "$DEPT" "$GROUP" "$OP$StartTime$SHIFT$QTY" "$USER >> $OUTFTP
done
### FTP of File
# ftp -n $FTP_HOST<<END_SCRIPT
# quote USER $FTP_USER
# quote PASS $FTP_PASSWD
# ascii
# cd dir1/subdir
# quote site blkzise=93
# quote site lrecl=93
# put $LOCAL_DIR/$XMT_FILE $REMOTE_DIR/$XMT_FILE
# quit
# END_SCRIPT
# EOF #