想把samba的数据备份到挂载的另一个硬盘中,我把这个硬盘的两个分区分别挂载到/mnt/bakcup and /mnt/share目录下!
这是备份脚本内容:
#!/bin/bash
##
## This script is about backup samba data
##
date=`date '+%Y%m%d'`
cd /mnt/backupdisk
mkdir $date -p
## Restart SMB Process
service smb restart
## Backup user directory (/home), but exclude /home/data/*
cd /
tar czpvf /mnt/backupdisk/$date/pdc_home_backup.tar.gz --exclude data/*
home 2>&1 &
## Backup share & profiles directory (/home/data)
cd /home/data
tar czpvf /mnt/backupdisk/$date/pdc_profiles_backup.tar.gz profiles &
tar czpvf /mnt/backupdisk/$date/pdc_share_backup.tar.gz share &
再我在crontab里加了一条
是让系统在每个星期三自动备份
# For backup this server (ltsp)
0 1 * * wed /opt/smbbackup.sh