Home | Mirror | Search

2. backup

#!/bin/sh
umount /mnt/backup
mount /dev/sdb1 /mnt/backup

if [ `date +%d` = '01' ] #每月1號進行完全備份
then
	bakdir="/mnt/bak/daybak/month/"`date +%m%d`
	zl="" #進行完全備份
else
	backup_dir="/mnt/backup/"`date +%d`
	zl="-N "`date +'%Y-%m-01 00:00:01'`; #差異備份
	#zl="-N "`date -d '-1 day' +'%Y-%m-%d 00:00:01'` #日增量備份
fi

tar "${zl}" -czf ${backup_dir}/www.tgz /var/www
umount /mnt/backup

		
comments powered by Disqus