MCPcopy Index your code
hub / github.com/opencloud-eu/opencloud / waitUntilCompleteShutdown

Function waitUntilCompleteShutdown

tests/ocwrapper/opencloud/opencloud.go:216–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

214}
215
216func waitUntilCompleteShutdown() (bool, string) {
217 timeout := 30 * time.Second
218 startTime := time.Now()
219
220 c := exec.Command("sh", "-c", "ps ax | grep 'opencloud server' | grep -v grep | awk '{print $1}'")
221 output, err := c.CombinedOutput()
222 if err != nil {
223 log.Println(err.Error())
224 }
225 for strings.TrimSpace(string(output)) != "" {
226 output, _ = c.CombinedOutput()
227 log.Println("Process found. Waiting...")
228
229 if time.Since(startTime) >= timeout {
230 log.Println(fmt.Sprintf("Unable to kill OpenCloud server after %v seconds", int64(timeout.Seconds())))
231 return false, "Timeout waiting for OpenCloud server to stop"
232 }
233 }
234 return true, "OpenCloud server stopped successfully"
235}
236
237func RunCommand(command string, inputs []string) (int, string) {
238 logs := new(strings.Builder)

Callers 2

StartFunction · 0.85
StopFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected