Share a script for backing up the CentOS system
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