1、首先配置ssh新任通信
2、构建Shell脚本
#!/bin/sh
DATE=`date +%Y_%m_%d_%H`
if [ $1 ]
then
for file in $(sed '/^$/d' $1)
do
if [ -f $file ]
then
res=`scp $file $2:$file`
if [ -z $res ]
then
echo $file >> ${DATE}_up.log
fi
elif [ -d $file ]
then
res=`scp -r $file $2:$file`
if [ -z $res ]
then
echo $file >> ${DATE}_up.log
fi
fi
done
else
echo "no file" >> ${DATE}_error.log
fi
3、上传格式
./file_up.sh jill 192.168.xx.xx
阅读(1033) | 评论(0) | 转发(1) |