- 论坛徽章:
- 0
|
本帖最后由 vinckdu 于 2011-09-13 17:01 编辑
又有个新的问题了!我把这个FTP编成了一个过程,然后在while do里面调用它,见最下面的代码,希望将文件传到FTP服务器上面去。
每次find 有文件match ,但是FTP服务器上面看文件没有,为什么呢??这个是我运行输出的log:请再帮忙看下!thanks .
pls dont close this terminal until your stability finished
Your ENMTG files(older than 1 day) will move to FTP server 10.186.5.106:/export/home/ftpadmin/SVO/ENMTGLOG/mytest/
/var/tmp/eNMTG_njiov01_1206.txt is transfering to FTP server ...
/var/tmp/eNMTG_njiov01_1206.txt transfer success!
delete /var/tmp/eNMTG_njiov01_1206.txt !
/var/tmp/eNMTG_njiov01_1206_1.txt is transfering to FTP server ...
/var/tmp/eNMTG_njiov01_1206_1.txt transfer success!
delete /var/tmp/eNMTG_njiov01_1206_1.txt !
/var/tmp/eNMTG_njiov01_1207.txt is transfering to FTP server ...
/var/tmp/eNMTG_njiov01_1207.txt transfer success!
delete /var/tmp/eNMTG_njiov01_1207.txt !
/var/tmp/eNMTG_njiov01_1207_1.txt is transfering to FTP server ...
/var/tmp/eNMTG_njiov01_1207_1.txt transfer success!
delete /var/tmp/eNMTG_njiov01_1207_1.txt !
/var/tmp/eNMTG_njiov01_1207_2.txt is transfering to FTP server ...
/var/tmp/eNMTG_njiov01_1207_2.txt transfer success!
delete /var/tmp/eNMTG_njiov01_1207_2.txt !
/var/tmp/eNMTG_njiov01_1207_3.txt is transfering to FTP server ...
/var/tmp/eNMTG_njiov01_1207_3.txt transfer success!
delete /var/tmp/eNMTG_njiov01_1207_3.txt !
/var/tmp/eNMTG_njiov01_1208.txt is transfering to FTP server ...
/var/tmp/eNMTG_njiov01_1208.txt transfer success!
delete /var/tmp/eNMTG_njiov01_1208.txt !
/var/tmp/eNMTG_njiov01_1208_1.txt is transfering to FTP server ...
/var/tmp/eNMTG_njiov01_1208_1.txt transfer success!
delete /var/tmp/eNMTG_njiov01_1208_1.txt !
#!/bin/bash
trap "echo 'the program interupted,pls run it again!';exit" HUP INT QUIT TSTP
if test $# -lt 1
then
echo " please enter the directory name !"
exit
fi
mydir=$1
myid=`whoami`
move() {
echo $1 is transfering to FTP server ...
ftp -n -i <<EOF
open 10.186.5.106
user svo svo
cd /export/home/ftpadmin/SVO/ENMTGLOG/$mydir/
put $1
EOF
echo "$1 transfer success!"
}
echo " pls dont close this terminal until your stability finished"
echo " Your ENMTG files(older than 1 day) will move to FTP server 10.186.5.106:/export/home/ftpadmin/SVO/ENMTGLOG/$mydir/ "
echo -e "\r"
#create backup directory
(
echo "user svo svo"
echo "mkdir /export/home/ftpadmin/SVO/ENMTGLOG/$mydir/"
)|ftp -i -n 10.186.5.106
while true
do
filelist=`find /var/tmp/eNMTG_$myid* -mtime +1`
# filelist=`find /var/tmp/eNMTG_$myid*`
for file in $filelist
do
if test $file
then
move $file
echo " delete $file !"
fi
done
sleep 3600
done |
|