【轉載】讓SVN作爲windows系統服務自動運行

方法一:


SVNService(將svn作爲服務運行的工具)

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放在的bin目錄下

Example:
比如,你的所有項目都在e:\svnrepo下,你可以如下
安裝時用 SVNService -install -d -r e:\svnrepo
更改時用 SVNService -setup -d -r e:\otherplace\svnrepo
如果訪問其中的一個項目e:\svnrepo\project1,可以指定路徑

svn://localhost/project1 (注:作爲url時用/)

第一次安裝完後要到服務中手動啓動它,
或者到服務中將它設爲自動啓動,讓每次機器啓動時自動啓動這個服務。

方法二:

Subversion 從1.4版本開始,可以以windows系統服務的形式在開機時自動運行。但Subversion安裝程序還不能把自己安裝成windows服務,需要我們自己進行手動安裝,方法如下: 打開一個DOS命令窗口,執行如下命令:  

sc create svnserve binPath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root e:\svn" 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 即可。 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章