WindowsNT技術(shù)簡介(windowsNT的特點(diǎn))
2024-10-06
更新時(shí)間:2023-09-05 00:21:34作者:未知
#!/bin/sh
#設(shè)定變量
bak_path=/root/bak_linux
date=$(date +%Y%m%d)
log_file=$bak_path/$date#log.log
#把執(zhí)行結(jié)果寫到日志中
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