Get the App
SLTechnology News&Howtos  ›  Servers  › 

Share a script for backing up the CentOS system

Shulou Source: shulou.com Published: 2022-06-01 23:38:00 11月13日 Update

Share a script for backing up the CentOS system? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

#! / bin/sh

# setting 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 into the $bak_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 $?

# upload backup files

Ftp-I-n-v

Tags: Backups files directories help systems scripts clarity content variables this articles beginners logs more knowledge results industry information information channels puzzles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft macOS Docker MySQL OPPO Reno