#!/bin/sh
echo "strat copy"
username="manager"
localpath=/home/root
sysdate=`date "+%Y%m%d"`
remoteip=172.19.2.75
remotepath=/home/manager/$sysdate.tar.gz
scp $username@$remoteip:$remotepath $localpath
echo "success copy"
echo "start tar the file "
cd $localpath
tar -xcvf $sysdate.tar.gz && echo "success tar the file"
echo end of tar the file "
echo "strat copy"
username="manager"
localpath=/home/root
sysdate=`date "+%Y%m%d"`
remoteip=172.19.2.75
remotepath=/home/manager/$sysdate.tar.gz
scp $username@$remoteip:$remotepath $localpath
echo "success copy"
echo "start tar the file "
cd $localpath
tar -xcvf $sysdate.tar.gz && echo "success tar the file"
echo end of tar the file "
Shell脚本实现文件备份
本文介绍了一个使用Shell脚本来实现远程文件备份的方法。通过scp命令将远程服务器上的文件复制到本地,并利用tar命令进行打包压缩,同时记录了具体的操作步骤及命令执行情况。
1978

被折叠的 条评论
为什么被折叠?



