svn自动生成并简易配置repository和重启服务的脚本

这篇博客介绍了如何使用脚本自动化创建SVN仓库,并进行简易配置,包括更改匿名访问权限和设置用户密码。同时,提供了重启SVN服务的脚本,方便管理和操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

svn的安装及配置:
svn自动生成并简易配置repository和重启服务的脚本:
========================脚本=========================
#!/bin/bash

conf=/conf/svnserve.conf
pw=/conf/passwd

changeConf(){
        sed -i 's\# anon-access = read\anon-accss = none\g'  "$1"${conf}
        sed -i 's\# auth-access = write\auth-accss = write\g'   "$1"${conf}
        sed -i 's\# password-db = passwd\password-db = passwd\g'  "$1"${conf}
}

addUser(){
        sed -i "s/# sally = sallyssecret/$2 = $3/g"  "$1"${pw}
}

if [ $# -lt 1 ];then
        echo "Error param no.!"
        echo "Usage(Root needed): svn.sh create reponame \nOR svn.sh restart "
        exit
fi

if [ "$1" == "create" ]; then
        if [ -z "$2" ]; then
                echo "Error param"
                exit
        fi
        home=/home/
        repo=${home}"$2"
        echo "creating repo" $repo

        svnadmin create $repo
        if [ $? -ne 0 ]; then
                echo create failed!
                exit;
        else
        read -p "inpute the username:" username
        read -p "inpute the password:" password
                changeConf $repo
                addUser $repo $username $password
        fi

elif [ "$1" == "restart" ]; then
        if [ -z "$2" ]; then
                read -p "Listen on which ip:" ip
        fi
        pid=`ps -e | grep svnserve | awk '{print $1}'`  
        kill -9 $pid 2>/dev/null 1>&2
        svnserve -d -r /home --listen-host $ip
else
        echo "error param"
fi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值