-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.go
51 lines (45 loc) · 1.44 KB
/
status.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
package workbench
import (
"fmt"
"strings"
"github.com/sol-eng/wbi/internal/system"
)
func StatusRStudioServerAndLauncher() error {
err := StatusRStudioServer()
if err != nil {
return fmt.Errorf("issue running status for rstudio-server: %w", err)
}
err = StatusRStudioLauncher()
if err != nil {
return fmt.Errorf("issue running status for rstudio-launcher: %w", err)
}
return nil
}
func StatusRStudioServer() error {
status, err := system.RunCommandAndCaptureOutput("rstudio-server status | cat", true, 1, false)
if err != nil {
return fmt.Errorf("issue running status for rstudio-server: %w", err)
}
if strings.Contains(status, "active (running)") {
system.PrintAndLogInfo(status)
system.PrintAndLogInfo("\nrstudio-server status is active (running)!")
} else {
system.PrintAndLogInfo(status)
system.PrintAndLogInfo("\nrstudio-server status is not active!")
}
return nil
}
func StatusRStudioLauncher() error {
status, err := system.RunCommandAndCaptureOutput("rstudio-launcher status | cat", true, 1, false)
if err != nil {
return fmt.Errorf("issue running status for rstudio-launcher with the command 'rstudio-launcher status | cat': %w", err)
}
if strings.Contains(status, "active (running)") {
system.PrintAndLogInfo(status)
system.PrintAndLogInfo("\nrstudio-launcher status is active (running)!")
} else {
system.PrintAndLogInfo(status)
system.PrintAndLogInfo("\nrstudio-launcher status is not active!")
}
return nil
}