(reason string)
| 84 | } |
| 85 | |
| 86 | func (a *App) Kill(reason string) error { |
| 87 | a.eventAdd("killing_app", |
| 88 | "pid", a.Command.Process.Pid, |
| 89 | "reason", reason, |
| 90 | ) |
| 91 | |
| 92 | fmt.Printf("! Killing '%s' (%d) - '%s'\n", a.Name, a.Command.Process.Pid, reason) |
| 93 | err := a.Command.Process.Signal(syscall.SIGTERM) |
| 94 | if err != nil { |
| 95 | a.eventAdd("killing_error", |
| 96 | "pid", a.Command.Process.Pid, |
| 97 | "error", err.Error(), |
| 98 | ) |
| 99 | fmt.Printf("! Error trying to kill %s: %s", a.Name, err) |
| 100 | } else { |
| 101 | // sigterm successful -- now that this app is stopped, remove it |
| 102 | // from pool so it is guaranteed be booted on the next request |
| 103 | a.pool.remove(a) |
| 104 | a.eventAdd("shutdown") |
| 105 | } |
| 106 | |
| 107 | return err |
| 108 | } |
| 109 | |
| 110 | func (a *App) watch() error { |
| 111 | c := make(chan error) |
no test coverage detected