CentOS System Backup Script detailed

Source: Internet
Author: User

#!/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 the _path directory

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 and. log files

RM-RF $bak _path/*#*.tar

RM-RF $bak _path/* #log. Log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.