Linux自动备份脚本
来源:岁月联盟
时间:2011-09-21
#!/bin/sh
backdir="/backup/mysql_date"
dirname="$(date +%Y%m%d)"
dirname_y="$(date +%Y)"
dirname_m="$(date +%m)"
targz="_192.168.1.6"
DIR="192.168.1.6"
for dir in $DIR
do
mkdir -p $backdir/$dirname_y/$dirname_m/$dir
mkdir -p /$dirname$targz
done
#update
cp -r /var/tmp/beoserver/test1.txt /var/tmp/beoserver/test2.txt /$dirname$targz
#web backup
tar zcfP /$backdir/$dirname_y/$dirname_m/$dir/$dirname$targz.tar.gz /$dirname$targz
rm -rf $dirname$targz
作者“专注成就卓越”