分类: IT职场
2013-02-02 10:51:58
#!/bin/sh
#backup files by date
DATE=`/bin/date +%Y%m%d`
/bin/tar -cfz /backup/$1.$DATE.tar.gz $1 > /dev/null 2>> /backup/$1.bak.log
if [ $? -eq 0 ]
then
echo "$1 $DATE backup successfuly" >> /backup/$1.bak.log
else
echo "ERROR:failure $1 $DATE backup!" >> /backup/$1.bak.log
fi
#crontab -e
#0 3 * * 2,5 script