徐小玉的博客。
分类: LINUX
2006-09-01 09:51:14
backup script(named cvsbackup):
#!/bin/sh
#define some variables
time_suffix=`date +%Y-%m-%d`
REPOS_PARENT_DIRECTORY=/cvs
REPOS_BACKUP_DIRECTORY=/export/backup
chkconfig cvspserver off
service xinetd restart
cd $REPOS_PARENT_DIRECTORY
tar -czpf cvsroot1-$time_suffix.tgz cvsroot1/*
tar -czpf repos2-$time_suffix.tgz repos2/*
tar -czpf repos_test-$time_suffix.tgz repos_test/*
tar -czpf legacy-$time_suffix.tgz repos_test/*
mv cvsroot1-$time_suffix.tgz $REPOS_BACKUP_DIRECTORY/
mv repos2-$time_suffix.tgz $REPOS_BACKUP_DIRECTORY/
mv repos_test-$time_suffix.tgz $REPOS_BACKUP_DIRECTORY/
mv legacy-$time_suffix.tgz $REPOS_BACKUP_DIRECTORY/
cd $REPOS_BACKUP_DIRECTORY
chown cvsadmin.cvsadmin cvsroot1-$time_suffix.tgz
chown cvsadmin.cvsadmin repos2-$time_suffix.tgz
crontab entry:
10 3 * * Fri /root/bin/cvsbackup