bash脚本之备份文件之拉回本地

#!/bin/bash
LOGFILE=/path/to/your/log/file.log
REMOTE=/path/to/remote/dir/
LOCAL=/path/to/local/dir

REMOTEIP=x.x.x.x
USERNAME=x.x.x.x
PORT=xxx

echo "CP remote dirs to local START at `date +%Y%m%d-%H:%M:%S`" >> $LOGFILE
scp -rv -P $PORT $USERNAMEt@$REMOTEIP:$REMOTE`date +%Y%m%d` $LOCAL
echo "CP remote dirs to local END at `date +%Y%m%d-%H:%M:%S`" >> $LOGFILE

发表评论

电子邮件地址不会被公开。 必填项已用*标注