#!/bin/bash # The is script backup /etc directory! # Author: zhangjun (E-MAILL: bard_zhang@foxmail.com) 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
本文出自 “汜水流年_” 博客,请务必保留此出处http://timefiles.blog.51cto.com/8475652/1786625
原文地址:http://timefiles.blog.51cto.com/8475652/1786625