From 6c0fd3e96bcfe48cb786b8d9750bd8e7f6a9bac0 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Mon, 26 Jan 2026 18:19:28 +0100 Subject: [PATCH] board/common: fix shell and clish 'follow' commands We want the command to show the entire log file, but fast forward to and tail at the end, handling any file rotations from syslogd. Signed-off-by: Joachim Wiberg --- board/common/rootfs/etc/bash.bashrc | 5 +++-- src/klish-plugin-infix/xml/infix.xml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/board/common/rootfs/etc/bash.bashrc b/board/common/rootfs/etc/bash.bashrc index 2d4c139a..8e916c93 100644 --- a/board/common/rootfs/etc/bash.bashrc +++ b/board/common/rootfs/etc/bash.bashrc @@ -40,11 +40,12 @@ log() less +G -r "$fn" } -follow() +follow () { local fn="/var/log/syslog" [ -n "$1" ] && fn="/var/log/$1" - less +F -r "$fn" + + tail -F -n +1 "$fn" } _logfile_completions() diff --git a/src/klish-plugin-infix/xml/infix.xml b/src/klish-plugin-infix/xml/infix.xml index b6786a43..e6b29cbf 100644 --- a/src/klish-plugin-infix/xml/infix.xml +++ b/src/klish-plugin-infix/xml/infix.xml @@ -744,7 +744,7 @@ file=${KLISH_PARAM_fn:-syslog} echo -e "\e[1mPress Ctrl-C to abort ────────────────────────────────────────────\e[0m" - tail -F /log/$file + tail -F -n +1 /log/$file