-
Notifications
You must be signed in to change notification settings - Fork 0
/
restart.go
54 lines (43 loc) · 908 Bytes
/
restart.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"fmt"
"io/ioutil"
)
func restartNodes() error {
defer killProcesses()
killProcesses()
files, err := ioutil.ReadDir(executablePath + `\data`)
if err != nil {
return fmt.Errorf("Data directory not found")
}
nodesCount := len(files) - 2
fmt.Println("Checking ports for availability...")
err = checkPorts(nodesCount)
if err != nil {
fmt.Println("Error: ", err)
return err
}
fmt.Print("Starting centrifugo... ")
err = startCentrifugo()
if err != nil {
fmt.Println("Error: ", err)
return err
}
fmt.Println("OK")
fmt.Println("Starting postgres... ")
err = startPostgres()
if err != nil {
fmt.Printf("Can't start postgres. Error: %s", err)
return fmt.Errorf("Can't start postgres. Error: ", err)
}
err = upNodes(nodesCount)
if err != nil {
return err
}
err = startFront(nodesCount)
if err != nil {
return err
}
waitClose()
return nil
}