让SVN作为windows系统服务自动运行

来源:互联网 发布:淘宝直播公会入驻 编辑:程序博客网 时间:2024/05/21 20:43

方法一:

SVNService(将svn作为windows服务运行的工具)

SVN Service Wrapper for Windows
This is my Win32 Service wrapper for SVN. Source is included, and its in the public domain. No need to copyright this stuff.

Usage instructions:

   SVNService -?                                to display this list
   SVNService -install <svnserve parameters>    to install the service
   SVNService -setup <svnserve parameters>      to change command line parameters for svnserve
   SVNService -remove                           to remove the service
   SVNService -debug                            to run as a console app for debugging

将svnservice.exe放在subversion的bin目录下

Example:
比如,你的所有项目都在e:/svnrepo下,你可以如下
安装时用   SVNService -install -d -r e:/svnrepo
更改时用   SVNService -setup -d -r e:/otherplace/svnrepo
如果访问其中的一个项目e:/svnrepo/project1,可以指定路径

svn://localhost/project1 (注:作为url时用/)

第一次安装完后要到服务中手动启动它,
或者到服务中将它设为自动启动,让每次机器启动时自动启动这个服务。

文件:SVNService.rar
大小:23KB
下载:下载


方法二:

Subversion 从1.4版本开始,可以以windows系统服务的形式在开机时自动运行。但Subversion安装程序还不能把自己安装成windows服务,需要我们自己进行手动安装,方法如下: 打开一个DOS命令窗口,执行如下命令:  


sc create svnserve binPath= "/"C:/Program Files/Subversion/bin/svnserve.exe/" --service --root e:/svn --listen-port 3691" displayname= "Subversion Repository" depend= Tcpip start= auto   


其中,sc是windows自带的服务配置程序,参数binPath表示svnserve可执行文件的安装路径,由于路径中的"Program Files"带有空格,因此整个路径需要用双引号引起来。而双引号本身是个特殊字符,需要进行转移,因此在路径前后的两个双引号都需要写成/"


--service参数表示以windows服务的形式运行,--root指明svn repository的位置,service参数与root参数都作为binPath的一部分,因此与svnserve.exe的路径一起被包含在一对双引号当中,而这对双引号不需要进行转义。


displayname表示在windows服务列表中显示的名字, depend =Tcpip 表示svnserve服务的运行需要tcpip服务,start=auto表示开机后自动运行。  


安装服务后,svnserve要等下次开机时才会自动运行。  


若要卸载svn服务,则执行 sc delete svnserve 即可。