增加卸载命令edge-node uninstall

This commit is contained in:
刘祥超
2023-08-01 15:36:04 +08:00
parent 6dccd0ad46
commit 8859625ce7
3 changed files with 68 additions and 8 deletions

View File

@@ -12,7 +12,6 @@ import (
"github.com/TeaOSLab/EdgeNode/internal/remotelogs"
"github.com/TeaOSLab/EdgeNode/internal/utils/fs"
_ "github.com/mattn/go-sqlite3"
"net/url"
"strings"
"sync"
"time"
@@ -202,12 +201,12 @@ func (this *DB) Close() error {
}()
// print log
if len(this.dsn) > 0 {
/**if len(this.dsn) > 0 {
u, _ := url.Parse(this.dsn)
if u != nil && len(u.Path) > 0 {
remotelogs.Debug("DB", "close '"+u.Path)
}
}
}**/
return this.rawDB.Close()
}

View File

@@ -62,10 +62,10 @@ func (this *ServiceManager) Uninstall() error {
}
// disable service
exec.Command(systemd, "disable", teaconst.SystemdServiceName+".service").Start()
_ = exec.Command(systemd, "disable", teaconst.SystemdServiceName+".service").Start()
// reload
exec.Command(systemd, "daemon-reload")
_ = exec.Command(systemd, "daemon-reload").Start()
return files.NewFile(systemdServiceFile).Delete()
}
@@ -149,7 +149,7 @@ WantedBy=multi-user.target`
executils.NewTimeoutCmd(30*time.Second, systemd, "stop", shortName+".service")
// reload
executils.NewTimeoutCmd(30*time.Second, systemd, "daemon-reload")
_ = executils.NewTimeoutCmd(30*time.Second, systemd, "daemon-reload").Start()
// enable
var cmd = executils.NewTimeoutCmd(30*time.Second, systemd, "enable", shortName+".service")