mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 09:18:31 +02:00
fix(proxmox): improve journalctl with log tailing fallback for non-systemd systems
- Format tail command with fallback retry logic - Add /var/log/messages fallback when no services specified Improves log viewing reliability on systems without systemd support.
This commit is contained in:
@@ -31,14 +31,15 @@ func formatTail(files []string, limit int) (string, error) {
|
||||
}
|
||||
}
|
||||
var command strings.Builder
|
||||
command.WriteString("tail -f -q --retry ")
|
||||
command.WriteString("tail -f -q ")
|
||||
for _, file := range files {
|
||||
fmt.Fprintf(&command, " %q ", file)
|
||||
}
|
||||
if limit > 0 {
|
||||
fmt.Fprintf(&command, " -n %d", limit)
|
||||
}
|
||||
return command.String(), nil
|
||||
// try --retry first, if it fails, try the command again
|
||||
return fmt.Sprintf("sh -c '%s --retry 2>/dev/null || %s'", command.String(), command.String()), nil
|
||||
}
|
||||
|
||||
func formatJournalctl(services []string, limit int) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user