权限位:
[root@localhost home] # ll svnhotcopy.sh
-rwxr-xr-x 1 root root 862 Nov 24 18:55 svnhotcopy.sh
[root@localhost home] # 

bash代码
[root@localhost home] # cat svnhotcopy.sh 
#!/bin/bash
MAXDAYS=7                       # 备份保留数目
TIME=`date +'%Y%m%d_%H%M%S'`
SVNPATH=/home/svn               # 定义仓库repos路径
BAKDIR=/home/backup             # 定义备份主目录
BAKSUBDIR=${BAKDIR}/${TIME}     # 定义全备路径
BAKLOG=${BAKDIR}/${TIME}.log    # 定义备份日志
[ ! -f "${BAKSUBDIR}" ] && mkdir -p ${BAKSUBDIR}
exec 1>${BAKLOG}
exec 2>&1

set -x
# 删除历史备份
find ${BAKDIR} -maxdepth 1 -type f -mtime +$(expr ${MAXDAYS} - 1) -exec echo "Delete {}" \; -exec rm "{}" \;
# 全备份
/usr/bin/svnadmin hotcopy ${SVNPATH} ${BAKSUBDIR}
# 如果能打印版本号说明备份正确
/usr/bin/svnlook youngest ${BAKSUBDIR}
[ $? -ne 0 ] && exit 1

cd ${BAKDIR}
# 压缩备份
tar -cvzf ${TIME}.tar.gz ${TIME}/
rm -rf ${BAKSUBDIR}
# 可以通过rsync把备份文件同步到远程备份机上,此处省略。
[root@localhost home] # 

计划任务
[root@localhost home] # cat /etc/crontab 
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed
  0 3  * * * root /home/svnhotcopy.sh

[root@localhost home] # 

重载计划任务
[root@localhost home] # systemctl reload crond.service