opengrok.sh
#!/bin/sh echo "`date +%Y-%m-%d_%H:%M:%S` --opengrok begin" >/home/trunk/mail.txt export PATH=/app/opengrok/jdk1.6.0_14/bin:/app/opengrok/jdk1.6.0_14/jre/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin export LANG="zh_CN.UTF-8" cd /home/trunk rm -rf trunk ls -l|grep ^d|grep RO50_m|wc -l >amount.txt read amount<amount.txt if [ $amount -ge 5 ] then ls -l|grep ^d|grep RO50_m|awk '{print $9}'|sort -r|awk 'END{print}'>del.txt read del<del.txt rm -rf $del fi svn ls http://172.16.40.214/svn/ro50/tags|grep 'RO50_m[0-9][0-9]'|sort|awk 'END{print}' >name.txt read name<name.txt if [ -d /home/trunk/$name ] then rm -rf $name fi svn export http://172.16.40.214/svn/ro50/tags/$name svn export http://172.16.40.214/svn/ro50/trunk cd /app/opengrok/opengrok-0.7/opengrok_date rm -rf * cd .. java -Xmx1524m -jar opengrok.jar -W /app/opengrok/opengrok-0.7/configuration.xml -P -S -v -s /home/trunk -d /app/opengrok/opengrok-0.7/opengrok_date cp configuration.xml /etc/opengrok/ /app/opengrok/glassfish/bin/asadmin stop-appserv /app/opengrok/glassfish/bin/asadmin start-appserv ||echo "`date +%Y-%m-%d_%H:%M:%S` --start-up error" >>/home/trunk/mail.txt echo "`date +%Y-%m-%d_%H:%M:%S` --start-up successful" >>/home/trunk/mail.txt mutt -s "172.16.40.211 opengrok" scm-svr-mtr@scm5.***.cn </home/trunk/mail.txt