#!/bin/bash
case "$1" in
start)
svnserve -d -r /svndata
svnport=`netstat -natp | grep svnserve | awk -F" " '{print $4}' |awk -F":" '{print $2}'| awk 'NR==1'`
if [ $svnport -eq 3690 ]
then
echo "SVN Server Already Runnning. Port:3690"
else
echo "SVN Server Does Not Start"
fi
;;
reload)
svnport=`netstat -natp | grep svnserve | awk -F" " '{print $4}' |awk -F":" '{print $2}'| awk 'NR==1'`
if [ $svnport -eq 3690 ]
then
killall svnserve && /data/apps/subversion/bin/svnserve -d -r /data/svndata/
echo "Reload OK"
else
echo "SVN Server Is Not Running"
fi
;;
stop)
killall svnserve
echo "SVN Server Has Been Stopped"
;;
status)
svnport=`netstat -natp | grep svnserve | awk -F" " '{print $4}' |awk -F":" '{print $2}'| awk 'NR==1'`
pid=`ps aux | grep svnserve | grep -v "grep" | awk '{print $2}'`
if [ $svnport -eq 3690 ]
then
echo "SVN Server (pid:$pid) 正在运行..."
else
echo "SVN Server 停止运行..."
fi
;;
*)
echo "$0: Usage: $0 {start|status|stop|reload}"
exit 1
;;
esac
注意:1 绿色部分需要自己调整,
找出3690端口号就行。 awk 'NR==1'` 意思是找出第一行第一个字段
2 红色部分也需要自己调整
/data/apps/subversion/bin/svnserve -d -r /data/svndata/
阅读(989) | 评论(0) | 转发(0) |