2016-02-04 67 views
1

目前,我安裝我的Topshelf Windows服務的命令行如何使用Topshelf命令行安裝服務恢復?

my.exe install -instance:1 -username:bob -password:pwd 

有誰知道,如果可能的話,包括服務恢復選項? 我不在命令行中看到任何內容 http://docs.topshelf-project.com/en/latest/overview/commandline.html

如果不支持,我的選項是什麼? 您可以在TopShelf Windows服務上使用sc.exe(服務控制管理器)嗎? https://technet.microsoft.com/en-us/library/cc742019.aspx

或者我應該把它吸起來,並使用應用程序配置文件來放入這些設置,並讀取值以編程方式執行它? http://docs.topshelf-project.com/en/latest/configuration/config_api.html#id1

HostFactory.New(x => 
{ 
    x.EnableServiceRecovery(rc => 
    { 
     rc.RestartService(1); // restart the service after 1 minute 
     rc.RestartSystem(1, "System is restarting!"); // restart the system after 1 minute 
     rc.RunProgram(1, "notepad.exe"); // run a program 
     rc.SetResetPeriod(1); // set the reset interval to one day 
    }) 
}); 

謝謝!

回答

1

所以,這是不可能的。但我會鼓勵你打開一個拉取請求來實現這一點。我不記得有其他人要求這樣做,但這似乎是一個合理的要求 - 至少在我們的問題跟蹤器Topshelf GitHub repo上打開一個問題。