mirror of https://github.com/winsw/winsw
Add stopwait command
parent
b0c09e1bb1
commit
a8fee1975f
|
@ -607,6 +607,10 @@ namespace winsw
|
||||||
Stop();
|
Stop();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case "stopwait":
|
||||||
|
StopWait();
|
||||||
|
return;
|
||||||
|
|
||||||
case "restart":
|
case "restart":
|
||||||
Restart();
|
Restart();
|
||||||
return;
|
return;
|
||||||
|
@ -815,6 +819,25 @@ namespace winsw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StopWait()
|
||||||
|
{
|
||||||
|
Log.Info("Stopping the service with id '" + descriptor.Id + "'");
|
||||||
|
if (s is null)
|
||||||
|
ThrowNoSuchService();
|
||||||
|
|
||||||
|
if (s.Started)
|
||||||
|
s.StopService();
|
||||||
|
|
||||||
|
while (s != null && s.Started)
|
||||||
|
{
|
||||||
|
Log.Info("Waiting the service to stop...");
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
s = svc.Select(descriptor.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.Info("The service stopped.");
|
||||||
|
}
|
||||||
|
|
||||||
void Restart()
|
void Restart()
|
||||||
{
|
{
|
||||||
Log.Info("Restarting the service with id '" + descriptor.Id + "'");
|
Log.Info("Restarting the service with id '" + descriptor.Id + "'");
|
||||||
|
@ -984,6 +1007,7 @@ namespace winsw
|
||||||
uninstall uninstall the service
|
uninstall uninstall the service
|
||||||
start start the service (must be installed before)
|
start start the service (must be installed before)
|
||||||
stop stop the service
|
stop stop the service
|
||||||
|
stopwait stop the service and wait until it's actually stopped
|
||||||
restart restart the service
|
restart restart the service
|
||||||
restart! self-restart (can be called from child processes)
|
restart! self-restart (can be called from child processes)
|
||||||
status check the current status of the service
|
status check the current status of the service
|
||||||
|
|
Loading…
Reference in New Issue