-
分享SVN的钩子代码[借鉴学习]pre-commit-post 钩子
- #/bin/bash
- REPOS=$1
- TXN=$2
- export HOME=/
- export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
- SVNLOOK=/usr/bin/svnlook
- CAT="$SVNLOOK cat -t $TXN $REPOS"
- $SVNLOOK changed -t "$TXN" "$REPOS" |awk '$1~/^[^D]/{print $NF}' |while read line; do
- #bash syntax check
- # if echo $line |grep -q '.sh$'; then
- # $CAT $line |bash -n 2>&2 && continue
- # echo "BASH SYNTAX ERROR: $line" >&2
- # exit 4
- # fi
- #perl syntax check
- if echo $line |grep -q '.pl$'; then
- $CAT $line |perl -c 2>&2 && continue
- echo "PERL SYNTAX ERROR: $line" >&2
- exit 4
- fi
- #puppet syntax check
- if echo $line |grep -q '.pp$'; then
- $CAT "$line" |puppet --color=false --parseonly --ignoreimport >&2
- [ $? -eq 0 ] && continue
- echo "PUPPET SYNTAX ERROR: $line" >&2
- exit 4
- fi
- #erb syntax check
- if echo $line |grep -q '.erb$'; then
- $CAT $line |erb -x -T '-' |ruby -c 2>&2 && continue
- echo "ERB SYNTAX ERROR: $line" >&2
- exit 4
- fi
- done
post-commit
- #!/bin/bash
- /usr/bin/svn update /etc/puppet/ --username test --password test >> /tmp/abc.out
- if [ $? == 0 ]
- then
- echo "ok" >> /tmp/thisabc.out
- /bin/rsync -avztpogdH --password-file=/opt/my2 /etc/puppet root@xxx.xxx.xxx.xxx::abc
- fi
-
相关阅读:
HashMap和HashTable区别【转载】
Linux常用指令【转载】
遇到的eclipse启动报错问题解决
个人总结
结对编程之黄金点游戏
第三周作业二
vs2013的安装以及单元测试
小学生整数四则运算
对于迅雷下载器的评价
关于软件工程的疑问
-
原文地址:https://www.cnblogs.com/lvdongjie/p/5304947.html
Copyright © 2020-2023
润新知