惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
量子位
S
SegmentFault 最新的问题
博客园 - 聂微东
博客园 - 【当耐特】
J
Java Code Geeks
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
V
V2EX
人人都是产品经理
人人都是产品经理
博客园 - Franky
罗磊的独立博客
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - YD

如何查找某一函数的定义 Ruby 线程--生产者、消费者 Ruby的函数指针 Rails2.0学习--真困难 加班赶工,得不偿失——历史给你上六课 Task Manager 1.1 开源软件:(Task Manager)任务管理-找出自己最需要完成的任务 小说阅读器 2.0 6. 创建 Subversion 服务 小说阅读器,有兴趣的同志可以试一下 不规则窗体的制作 播放 wave 文件 简单 Socket 通信 CRC 校验 C# 实现法 5. 多人协作 C# 中信号量的使用 4. 不要把不必要的文件版本化 3. 从 Repository 中恢复 2. 创建你的 Repository
7. 创建Subversion服务之补充
YD · 2007-11-25 · via 博客园 - YD

手工启动Subversion服务容易出错,尤其是一个空格没打好也不行。所以我写了两个脚本,一个用来创建服务,一个用来删除服务。这两个脚本在Windows资源管理器里可直接运行。

Notice:就像第一个脚本注释里写的一样,运行Create Service.js时请右键点击“在命令行里运行”方可。不然会产生运行时错误。

Create Service.js

/*    Author: 杨冬
    Date: 2007-11-24
    
    This script is used to create subversion service and start it. The user is supposed to excute this script in the command line
    mode. Right click on the script file, select "Open in command line". When the script was running, it would ask you to type the
    svnserve.exe path which is exactly the same as subversion installation path and your respository path. If you specify nothing,
    their values would be replaced by their default values which is only suitable on my computer. :) Therefore, DON'T left the
    respository path empty.
*/


// Declarations
var serviceName = "svn";                                                // Service name
var srvPath = "";                                                    // Path of svnserve.exe
var resPath = "";                                                    // Path of your svn respository
var defaultSrvPath = "C:\\Program Files\\Subversion\\bin\\svnserve.exe";    // Default binPath
var defaultResPath = "C:\\Documents and Settings\\杨冬\\Files\\SvnRepos";    // Default resPath
var displayName = "Subversion Server";    // Display name

// Read the srvPath and resPath from user.
var stdin = WScript.Stdin;
var stdout = WScript.Stdout;
var srvPathPrompt = "请输入 svnserve.exe 的安装目录:";
stdout.WriteLine(srvPathPrompt);
var srvPath = stdin.ReadLine();
var resPathPrompt = "请输入您 Repository 的目录:";
stdout.WriteLine(resPathPrompt);
var resPath = stdin.ReadLine();
// If user entered nothing, then set srvPath and resPath to their default values.
if (srvPath == "") srvPath = defaultSrvPath;
if (resPath == "") resPath = defaultResPath;

// Assemble command string
var cmdStr = "sc create " + serviceName + " binpath= \"\\\"" + srvPath + "\\\"" +
    
" --service -" + "\\\"" + resPath + "\\\"\" displayname= \"" + displayName +
    
"\" depend= Tcpip start= auto";

// Create the svn service.
var wshShell = WScript.CreateObject("WScript.Shell"); // Get WshShell object.
var oExec = wshShell.Exec(cmdStr); // Execute command.
while (oExec.Status == 0) WScript.Sleep(100); // Wait for command execution finish.

// Start the svn service.
var runCmd = "net start " + serviceName;
oExec 
= wshShell.Exec(runCmd);
while (oExec.Status == 0) WScript.Sleep(100);

// Show the user tip.
var tipStr = "服务已经启动\n" +
    
"svnserve.exe 路径:\t" + srvPath + "\n" +
    
"respository 路径:\t" + resPath;
wshShell.Popup(tipStr);

Delete Service.js

/*    Author: 杨冬
    Date: 2007-11-24
    
    This script will delete the subversion service on your computer. But the service must be named as "svn".
    If not, there would be no effect at all.
*/


var serviceName = "svn";    // Service name
var stopCmd = "net stop " + serviceName;
var delCmd = "sc delete " + serviceName;

// Execute command
var wshShell = WScript.CreateObject("WScript.Shell"); // Get WshShell object.
var oExec = wshShell.Exec(stopCmd); // Stop the service
while (oExec.Status == 0) WScript.Sleep(100); // Wait for command execution finish.
var oExec = wshShell.Exec(delCmd); // Delete the service
while (oExec.Status == 0) WScript.Sleep(100); // Wait for command execution finish.

// Show user tip.
var tipStr = "服务已经删除";
wshShell.Popup(tipStr);