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?