首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

Shell拷贝当地文件到远程主机

2012-07-26 
Shell拷贝本地文件到远程主机#!/bin/shtimelimit2if [ $# -ne 0 ] then timelimit$1fistartdate`date

Shell拷贝本地文件到远程主机

#!/bin/shtimelimit=2if [ $# -ne 0 ] ; then timelimit=$1fistartdate=`date +%m%d`for((i=1;i<=$timelimit;i++));do  count=`expr  $i \* 24`  result=`printf %03d $count`    logdate=`date +%F`  logtime=`date +%T`  file="/disk2/diamond/update/gwcity/gc${startdate}20.$result"  if [ -a file ] ; then    echo "$logdate $logtime warn $file is not exists" >> /root/taskmonitor/log.log  else    scpStr="scp $file root@10.0.64.223:/data/gwcity/"    $scpStr    if [ $? -eq 0 ] ; then      echo "$logdate $logtime debug $scpStr is successfully" >> /root/taskmonitor/log.log    else      echo "$logdate $logtime error $scpStr is failure" >> /root/taskmonitor/log.log    fi  fidone
?

热点排行