Skip to content

Commit 51daad8

Browse files
Show and follow dmesg messages on the screen
Needs to be run under root or sudo. Fined tuned for lxdm-session at the moment. A DM neutral version can be made as well but I'm too lazy for that. This handy script will show and follow dmesg messages on the screen. Prints three lines at a time.
1 parent 2f5c55d commit 51daad8

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Diff for: dmesg-notify

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#! /bin/bash
2+
3+
#----------------------------------------------------------------------
4+
# Description: show dmesg messages on the screen for modern Linux'es
5+
# Fined tuned for lxdm-session
6+
#
7+
# Author: Artem S. Tashkinov
8+
# Created at: Tue 10 Dec 2019 03:29:57 AM
9+
# Computer: localhost.localdomain
10+
# System: Linux 5.4.2-zen2 on x86_64
11+
#
12+
# Copyright (c) 2019 Artem S. Tashkinov All rights reserved.
13+
#----------------------------------------------------------------------
14+
15+
icon=/path/to/icon_32x32.png
16+
timeout=3 # visual cue for this number of seconds
17+
18+
nl='
19+
'
20+
21+
journalctl -kf | while read -r line1; read -r -t 1 line2; read -r -t 1 line3; true; do
22+
23+
test -n "$line2" && line1="$line1$nl"
24+
test -n "$line3" && line2="$line2$nl"
25+
26+
pid_lxdm=`pidof lxdm-session`
27+
Xuser=0 # this might not work - needs to be tested
28+
test -z "$pid_lxdm" || Xuser=`ps -u --ppid "$pid_lxdm" | tail -1 | awk '{print $1}'`
29+
30+
if [ -n "$Xuser" ]; then
31+
su "$Xuser" -c "DISPLAY=:0 notify-send --expire-time="${timeout}000" --icon="${icon}" 'Kernel message' '$line1$line2$line3' &> /dev/null" &
32+
fi
33+
34+
done

0 commit comments

Comments
 (0)