CentOS system backup script

Source: Internet
Author: User

#! /Bin/sh

# Set Variables

Bak_path =/root/bak_linux

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

Log_file = $ bak_path/$ date # log. log


# Write the execution result to the log

Exec 1> $ log_file 2> & 1


# Package the directory to be backed up in the $ bak_path directory.

Tar-zcvf $ bak_path/logs/boot

Tar-zcvf $ bak_path/Tables/etc

Tar-zcvf $ bak_path/Tables/var

Echo "############ \ n"

Echo $?


# Uploading backup files

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 $?


Delete the uploaded .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.