欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

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

程序员文章站 2023-01-08 17:07:03
复制代码 代码如下:#!/bin/bashcase "$1" instart)        svns...

复制代码 代码如下:

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