mirror of
https://github.com/henrygd/beszel.git
synced 2025-10-30 10:07:02 +00:00
Fixed OpenWRT agent restarter logic (#1210)
* Fixed OpenWRT restarter logic * Update update.go
This commit is contained in:
@@ -40,11 +40,12 @@ func (o *openRCRestarter) Restart() error {
|
|||||||
type openWRTRestarter struct{ cmd string }
|
type openWRTRestarter struct{ cmd string }
|
||||||
|
|
||||||
func (w *openWRTRestarter) Restart() error {
|
func (w *openWRTRestarter) Restart() error {
|
||||||
if err := exec.Command(w.cmd, "running", "beszel-agent").Run(); err != nil {
|
// https://openwrt.org/docs/guide-user/base-system/managing_services?s[]=service
|
||||||
|
if err := exec.Command("/etc/init.d/beszel-agent", "running").Run(); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ghupdate.ColorPrint(ghupdate.ColorYellow, "Restarting beszel-agent via procd…")
|
ghupdate.ColorPrint(ghupdate.ColorYellow, "Restarting beszel-agent via procd…")
|
||||||
return exec.Command(w.cmd, "restart", "beszel-agent").Run()
|
return exec.Command("/etc/init.d/beszel-agent", "restart").Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
type freeBSDRestarter struct{ cmd string }
|
type freeBSDRestarter struct{ cmd string }
|
||||||
@@ -64,11 +65,13 @@ func detectRestarter() restarter {
|
|||||||
if path, err := exec.LookPath("rc-service"); err == nil {
|
if path, err := exec.LookPath("rc-service"); err == nil {
|
||||||
return &openRCRestarter{cmd: path}
|
return &openRCRestarter{cmd: path}
|
||||||
}
|
}
|
||||||
|
if path, err := exec.LookPath("procd"); err == nil {
|
||||||
|
return &openWRTRestarter{cmd: path}
|
||||||
|
}
|
||||||
if path, err := exec.LookPath("service"); err == nil {
|
if path, err := exec.LookPath("service"); err == nil {
|
||||||
if runtime.GOOS == "freebsd" {
|
if runtime.GOOS == "freebsd" {
|
||||||
return &freeBSDRestarter{cmd: path}
|
return &freeBSDRestarter{cmd: path}
|
||||||
}
|
}
|
||||||
return &openWRTRestarter{cmd: path}
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user