tools/etcd-agent: stop etcd only if it is running

Stop etcd only if it is running, and not report error when stopping etcd
which is not started.
This commit is contained in:
Yicheng Qin 2015-03-28 18:22:43 -07:00
parent 9a33678878
commit 097a56fe01

View File

@ -73,6 +73,9 @@ func (a *Agent) start(args ...string) error {
// stop stops the existing etcd process the agent started.
func (a *Agent) stop() error {
if a.state != stateStarted {
return nil
}
err := a.cmd.Process.Kill()
if err != nil {
return err