linux shell

svn服务器启动和svn服务器重启、停止等操作脚本分享

本文主要是介绍svn服务器启动和svn服务器重启、停止等操作脚本分享,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

复制代码 代码如下:

#!/bin/bash
case "$1" in
start)
        svnserve -d -r /svndata
        svnport=`netstat -natp | grep svnserve | awk -F: '{print $4}' | 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 'NR==1'`
        if [ $svnport -eq 3690 ]
        then
                killall svnserve && svnserve -d -r /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 '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
这篇关于svn服务器启动和svn服务器重启、停止等操作脚本分享的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
您可能喜欢