Some checks failed
Native Verification / Build Docs (pull_request) Successful in 1m12s
Native Verification / Build App-Service Native (pull_request) Successful in 1m27s
Native Verification / Build Daemon Native (pull_request) Successful in 42s
Lint and Test Charts / lint-test (pull_request_target) Failing after 19s
Lint and Test Charts / test-version (pull_request_target) Successful in 0s
Lint and Test Charts / push-image (pull_request_target) Failing after 15s
Lint and Test Charts / upload-cli (pull_request_target) Failing after 1m15s
Lint and Test Charts / upload-daemon (pull_request_target) Failing after 1m12s
Lint and Test Charts / push-deps (pull_request_target) Has been skipped
Lint and Test Charts / push-deps-arm64 (pull_request_target) Has been skipped
Lint and Test Charts / push-image-arm64 (pull_request_target) Has been cancelled
Lint and Test Charts / upload-package (pull_request_target) Has been cancelled
Lint and Test Charts / install-test (pull_request_target) Has been cancelled
43 lines
987 B
Go
43 lines
987 B
Go
package os
|
|
|
|
import (
|
|
"time"
|
|
|
|
"log"
|
|
|
|
"github.com/beclab/beos/cli/pkg/pipelines"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func NewCmdStart() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "start",
|
|
Short: "Start the beOS Pro",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if err := pipelines.StartBeOS(); err != nil {
|
|
log.Fatalf("error: %v", err)
|
|
}
|
|
},
|
|
}
|
|
return cmd
|
|
}
|
|
|
|
func NewCmdStop() *cobra.Command {
|
|
var (
|
|
timeout time.Duration
|
|
checkInterval time.Duration
|
|
)
|
|
cmd := &cobra.Command{
|
|
Use: "stop",
|
|
Short: "Stop the beOS Pro",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
if err := pipelines.StopBeOS(timeout, checkInterval); err != nil {
|
|
log.Fatalf("error: %v", err)
|
|
}
|
|
},
|
|
}
|
|
cmd.Flags().DurationVarP(&timeout, "timeout", "t", 1*time.Minute, "Timeout for graceful shutdown before using SIGKILL")
|
|
cmd.Flags().DurationVarP(&checkInterval, "check-interval", "i", 10*time.Second, "Interval between checks for remaining processes")
|
|
return cmd
|
|
}
|