限制svn上传文件大小
为了方便管理和避免一些问题,svn上传文件需要限制文件大小 svn有几种钩子,资料一搜一大把,限制上传文件大小需要用到 pre-commit 在仓库hooks目录下有示例配置文件,新建一个名为 pre-commit 的脚本,内容如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #!/bin/bash REPOS="$1" TXN="$2" SVNLOOK=/usr/bin/svnlook MAX_SIZE=512000 files=$($SVNLOOK changed -t $TXN $REPOS | awk '{print $2}') # check check if [[ $files =~ "project_nuli" ]];then for f in $files do # check file size filesize=$($SVNLOOK cat -t $TXN $REPOS $f | wc -c) if [ $filesize -gt $MAX_SIZE ] ; then echo "File $f is too large (must <= $MAX_SIZE)" >> /dev/stderr exit 1 fi done fi exit 0 客户端提交大于500K文件会返回 File $f is too large (must <= $MAX_SIZE)...