improve systemd or docker detection

This commit is contained in:
Alireza Ahmadi
2024-10-29 13:14:25 +01:00
parent 1d46d72186
commit 282e244517
4 changed files with 14 additions and 4 deletions
+1 -2
View File
@@ -145,10 +145,9 @@ func (s *ServerService) GetLogs(service string, count string, level string) []st
if service == "s-ui" {
return logger.GetLogs(c, level)
}
ppid := os.Getppid()
var lines []string
var cmdArgs []string
if ppid > 1 {
if IsSystemd {
cmdArgs = []string{"journalctl", "-u", service, "--no-pager", "-n", count, "-p", level}
} else {
cmdArgs = []string{"tail", "/logs/" + service + ".log", "-n", count}