- #/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
- #!/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