Skip to content

IoTDB在windows下以服务的方式如何运行? #10989

Answered by januswx
januswx asked this question in Q&A
Discussion options

You must be logged in to vote

我使用C#写了一个Windows的服务程序,在里面通过调用cmd命令,启动服务执行start-confignode.bat和start-datanode.bat,停止服务执行stop-confignode.bat和stop-datanode.bat,关键代码如下:

using Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = $"/C {batFile}";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;

process.Start();

process.WaitForExit();

现在已经可以以服务的方式运行了,谢谢大家

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@januswx
Comment options

Comment options

You must be logged in to vote
1 reply
@januswx
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by januswx
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants