#!/bin/bash # The is script backup /etc directory! # Author: zhangjun (E-MAILL: [email protected]) date=$(date +%y%m%d) size=$(du -sh /etc) if [ -d /tmp/dbbak ] then echo "Date: $date!" > /tmp/dbbak/dbinfo.txt echo "Size: $size!" >> /tmp/dbbak/dbinfo.txt cd /tmp/dbbak tar -zcf etc_$date.tar.gz /etc dbinfo.txt &> /dev/null rm -rf /tmp/dbbak/dbinfo.txt else mkdir /tmp/dbbak echo "Date: $date!" > /tmp/dbbak/dbinfo.txt echo "Size: $size!" >> /tmp/dbbak/dbinfo.txt cd /tmp/dbbak tar -zcf etc_$date.tar.gz /etc dbinfo.txt &> /dev/null rm -rf /tmp/dbbak/dbinfo.txt fi
时间: 2024-11-11 23:51:15