@@ -45,9 +45,9 @@ const (
4545 ServiceStateSuccess = "success"
4646 // ServiceStateError is return when we a service exit with an error (exit code != 0)
4747 ServiceStateError = "error"
48- //ServiceStateFailure is set of zinit can not spawn a service in the first place
49- //due to a missing executable for example. Unlike `error` which is returned if the
50- //service itself exits with an error.
48+ // ServiceStateFailure is set of zinit can not spawn a service in the first place
49+ // due to a missing executable for example. Unlike `error` which is returned if the
50+ // service itself exits with an error.
5151 ServiceStateFailure = "failure"
5252)
5353
@@ -204,7 +204,6 @@ type ServiceStatus struct {
204204func (c * Client ) List () (out map [string ]ServiceState , err error ) {
205205 err = c .cmd ("list" , & out )
206206 return
207-
208207}
209208
210209// Status returns the status of a service
@@ -310,6 +309,11 @@ func (c *Client) Stop(service string) error {
310309 return c .cmd (fmt .Sprintf ("stop %s" , service ), nil )
311310}
312311
312+ // Re restarts a service.
313+ func (c * Client ) Restart (service string ) error {
314+ return c .cmd (fmt .Sprintf ("restart %s" , service ), nil )
315+ }
316+
313317// StartWait starts a service and wait until its running, or until the timeout
314318// (seconds) pass. If timedout, the method returns an error if the service is not running
315319// timout of 0 means no wait. (similar to Stop)
0 commit comments