netmaker/netclient/daemon/common.go

31 lines
580 B
Go
Raw Normal View History

2021-09-20 02:03:47 +08:00
package daemon
import (
"errors"
"runtime"
"github.com/gravitl/netmaker/netclient/config"
)
func InstallDaemon(cfg config.ClientConfig) error {
os := runtime.GOOS
var err error
interval := "15"
if cfg.Server.CheckinInterval != "" {
interval = cfg.Server.CheckinInterval
}
2021-09-20 02:03:47 +08:00
switch os {
case "windows":
err = SetupWindowsDaemon()
case "darwin":
err = SetupMacDaemon(interval)
2021-09-20 02:03:47 +08:00
case "linux":
err = SetupSystemDDaemon(interval)
2021-09-20 02:03:47 +08:00
default:
err = errors.New("this os is not yet supported for daemon mode. Run join cmd with flag '--daemon off'")
}
return err
}