From 5065224181afc315487376be09bc78c35b25805f Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 3 Oct 2022 17:54:59 +0200 Subject: [PATCH] zshrc: run tlog alias with --follow=name It's annoying to follow the syslog, but then tools like logroate kicking in to rename syslog to syslog.1. Then you're stuck with the "old" syslog file content, by using the --follow=name option we can fix this. Quoting from tail(1): | With --follow (-f), tail defaults to following the file descriptor, | which means that even if a tail'ed file is renamed, tail will continue | to track its end. This default behavior is not desirable when you really | want to track the actual name of the file, not the file descriptor | (e.g., log rotation). Use --follow=name in that case. That causes tail | to track the named file in a way that accommodates renaming, removal and | creation. --- doc/grmlzshrc.t2t | 2 +- etc/zsh/zshrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/grmlzshrc.t2t b/doc/grmlzshrc.t2t index 9016cea..485587a 100644 --- a/doc/grmlzshrc.t2t +++ b/doc/grmlzshrc.t2t @@ -1106,7 +1106,7 @@ http://www.cl.cam.ac.uk/~mgk25/unicode.html#term). Sets mode from ISO 2022 to UTF-8 (See: http://www.cl.cam.ac.uk/~mgk25/unicode.html#term). -: **tlog** (//tail -f /var/log/syslog//) +: **tlog** (//tail --follow=name /var/log/syslog//) Prints syslog continuously (See tail(1)). : **up** (//aptitude update ; aptitude safe-upgrade//) diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index b369aca..bb8ecec 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -2848,7 +2848,7 @@ if [ -e /var/log/syslog ] ; then #a1# Take a look at the syslog: \kbd{\$PAGER /var/log/syslog || journalctl} salias llog="$PAGER /var/log/syslog" # take a look at the syslog #a1# Take a look at the syslog: \kbd{tail -f /var/log/syslog || journalctl} - salias tlog="tail -f /var/log/syslog" # follow the syslog + salias tlog="tail --follow=name /var/log/syslog" # follow the syslog elif check_com -c journalctl ; then salias llog="journalctl" salias tlog="journalctl -f" -- 2.1.4