Chinaunix首页 | 论坛 | 博客
  • 博客访问: 188799
  • 博文数量: 49
  • 博客积分: 1061
  • 博客等级: 少尉
  • 技术积分: 635
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-21 08:42
文章分类

全部博文(49)

文章存档

2015年(1)

2014年(2)

2013年(1)

2012年(45)

分类: IT业界

2012-01-04 20:55:11

#!/bin/ksh
##############################################################################
#File Name : file_mv.sh
#Procedure Class? : Unix shell program
#Data Form : YYYY/MM/DD
#Description??? : 10.10.2.91 to 10.20.2.205
#Input :
#Output : /tmp/filemv_erro_back.log
#
# Ver Date Author Description
# ===== ========== ===================== ====================================
# 1.00 2009/05/04 Stein Yang Create#
#
################################################################################

nowdate=`date +"20%y%m%d"`
myhost=`hostname`
while [ "`awk '{ if (NR==1)print}' /usr/ivoscripts/date.txt`" -lt "$nowdate" ]
do
datadir=`awk '{ if (NR==1)print}' /usr/ivoscripts/date.txt`

#####################################################################
while read filename
do
station=`echo "$filename" |awk '{ print $1 }'`
location=`echo "$filename" |awk '{ print $2 }'`
disk=`echo "$filename" |awk '{ print $3 }'`
#####################################################################
cd /BKFILE/$location/IMAGE/$datadir/
find ./ -name "*_$"station"_*.jpg" |cut -c3-100 1>/tmp/$station.txt 2>>/tmp/filemv_erro.log
while read filename
do

login_name="ivousr"
password="ivousr"
dir1=/$disk/images/$station/$datadir/
dir2=/BKFILE/$location/IMAGE/$datadir/
ftp -v -n 10.20.2.205 << EOF
user $login_name $password
mkdir /$disk/images/$station/${datadir}
binary
cd $dir1
lcd $dir2
prompt
mput $filename
bye
EOF
done < /tmp/$station.txt 2>>/tmp/filemv_erro.log
#####################################################################
done < /usr/ivoscripts/station.txt 2>>/tmp/filemv_erro.log
#####################################################################

sed -i '1d' /usr/ivoscripts/date.txt
done
mail -s "$myhost filemv error log " steinyang@ivo.com.cn cat /tmp/filemv_erro.log >>/tmp/filemv_erro_back.log
cat /dev/null >/tmp/filemv_erro.log
exit 0
#shell end
阅读(810) | 评论(3) | 转发(0) |
给主人留下些什么吧!~~

LivePUB2012-01-04 20:56:51

这次改进是一个栈点的数据一次ftp传完,引用文件:
[root@KABPFS01 /usr/ivoscripts/file_eda]# more while.txt
station=`cat /usr/ivoscripts/file_eda/sta.txt |awk '{ print $1 }'`
location=`cat /usr/ivoscripts/file_eda/sta.txt |awk '{ print $2 }'`
disk=`cat /usr/ivoscripts/file_eda/sta.txt |awk '{ print $3 }'`
datadir=`awk '{ if (NR==1)print}' /usr/ivoscripts/file_eda/date.txt



脚本会生成第二个脚本station.sh,然后运行station.sh进行ftp动作。

LivePUB2012-01-04 20:56:35

#!/bin/ksh
##############################################################################
#File Name              :       file_mv.sh      
#Procedure Class?      :       Unix shell program        
#Data Form              :       YYYY/MM/DD

LivePUB2012-01-04 20:56:21

马虎啊,马虎,一个符号的错误!!!
改进版

#!/bin/ksh
##############################################################################
#File Name              :       file_mv.sh      
#Procedure Class?      :       Unix shell program        
#Data Form             &nb