FTP上传脚本与主机自建传输脚本(AIX)

#!/bin/sh
DAY=`date "+%Y-%m-%d %H:%M:%S"`
ip=10.244.152.51
port="22"
passwd=ucp@1234
local_dir=/app/chargefile/chargeRate/
remote_dir=/app2/chargefile/chargeRate_from_rac


to_51() {
expect -c "
  spawn scp -rp  $port $local_dir root@$ip:$remote_dir
  expect {
    \"*assword\" {set timeout 300; send \"$passwd\r\";}
    \"yes/no\" {send \"yes\r\"; exp_continue;}
  }
  expect eof"

cd $local_dir
mv * /app/chargefile/chargeRate_bak
                }



find /app/chargefile/chargeRate   -mmin  -10   -type f -print   > /tmp/wei.txt
m_update=`cat /tmp/wei.txt  | wc -l`
if [ $m_update  -eq  "0" ];
#if [ $m_update  -ne  "0" ];
then
to_51
echo  "$DAY Sync-51"

fi


以上十分钟之内数据没变化的话,则执行函数里面的脚本。将数据传到 10.244.152.51


root@S1_KC_APP_DB:[/home/netvour]cat /home/milton/shell/ftp.sh
#!/bin/sh
cd /app2/chargefile/chargeRate_from_rac/chargeRate
chmod 777 *
ftp -n< open 10.251.63.45
user workftp ftp63FTP
binary
hash
cd /aibsm3/workftp/recharge
prompt
mput *
quit

ftp -n< open 10.251.63.37
user workftp ftp63FTP
binary
hash
cd /aibsm3/workftp/recharge
prompt
mput *
close
bye
!


以上是将51上的数据传到ftp  10.251.63.37  10.251.63.45上





你可能感兴趣的:(Perl/Shell)