#/bin/bash
#backup files by date
#filename autobak.sh
DATE=`/bin/date +%Y%m%d`
/bin/tar -cf /backup/$1.$DATE.tar $1 > /dev/null 2>>/backup/$1.bak.log
/bin/gzip /backup/$1.$DATE.tar
if [ $? -eq 0 ]
then
echo "$1 $DATE backup successfully" >>/backup/$1.bak.log
else
echo "ERROR:failure $1 $DATA backup!">>/backup/$1.bak.log
fi
备份/etc/目录下所有的文件,
#/bin/bash autobak /etc
备份后的压缩文件名为 etc.20130604.tar.gz
2016-11-16
自动备份命令autobak.sh
评论
发表评论
姓 名: