Install 安装服务
(exePath string, args []string)
| 21 | |
| 22 | // Install 安装服务 |
| 23 | func (this *ServiceManager) Install(exePath string, args []string) error { |
| 24 | if os.Getgid() != 0 { |
| 25 | return errors.New("only root users can install the service") |
| 26 | } |
| 27 | |
| 28 | systemd, err := executils.LookPath("systemctl") |
| 29 | if err != nil { |
| 30 | return this.installInitService(exePath, args) |
| 31 | } |
| 32 | |
| 33 | return this.installSystemdService(systemd, exePath, args) |
| 34 | } |
| 35 | |
| 36 | // Start 启动服务 |
| 37 | func (this *ServiceManager) Start() error { |
no test coverage detected