您好,欢迎来到思海网络,我们将竭诚为您提供优质的服务! 诚征网络推广 | 网站备案 | 帮助中心 | 软件下载 | 购买流程 | 付款方式 | 联系我们 [ 会员登录/注册 ]
促销推广
客服中心
业务咨询
有事点击这里…  531199185
有事点击这里…  61352289
点击这里给我发消息  81721488
有事点击这里…  376585780
有事点击这里…  872642803
有事点击这里…  459248018
有事点击这里…  61352288
有事点击这里…  380791050
技术支持
有事点击这里…  714236853
有事点击这里…  719304487
有事点击这里…  1208894568
有事点击这里…  61352289
在线客服
有事点击这里…  531199185
有事点击这里…  61352288
有事点击这里…  983054746
有事点击这里…  893984210
当前位置:首页 >> 技术文章 >> 文章浏览
技术文章

CentOS系统备份脚本详解

添加时间:2019-11-4 21:20:51  添加: 思海网络 
#!/bin/sh

#设定变量

bak_path=/root/bak_linux

date=$(date +%Y%m%d)

log_file=$bak_path/$date#log.log

#把执行结果写到日志中

exec 1>>$log_file 2>&1

#把要备份的目录打包放到$bak_path目录下

tar -zcvf $bak_path/$date#boot.tar.gz /boot

tar -zcvf $bak_path/$date#etc.tar.gz /etc

tar -zcvf $bak_path/$date#var.tar.gz /var

echo "############\n"

echo $?

#上传备份文件

ftp -i -n -v << FTPIT

open 192.168.0.27

user 111 111

binary

lcd $bak_path

mput *.tar.gz

put *#log.log

by

FTPIT

echo "############\n"

echo $?

#删除上传完毕的.tar和.log文件

rm -rf $bak_path/*#*.tar

rm -rf $bak_path/*#log.log


关键字:CentOS、系统、备份、脚本
分享到:

顶部 】 【 关闭
版权所有:佛山思海电脑网络有限公司 ©1998-2024 All Rights Reserved.
联系电话:(0757)22630313、22633833
中华人民共和国增值电信业务经营许可证: 粤B1.B2-20030321 备案号:粤B2-20030321-1
网站公安备案编号:44060602000007 交互式栏目专项备案编号:200303DD003  
察察 工商 网安 举报有奖  警警  手机打开网站