Log dmesg errors and warnings
authorSiraaj Khandkar <siraaj@khandkar.net>
Thu, 29 Sep 2022 10:37:42 +0000 (06:37 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Thu, 29 Sep 2022 10:37:42 +0000 (06:37 -0400)
home/.xlaunch.d/99-dmesg-notifier-error
home/.xlaunch.d/99-dmesg-notifier-warn

index 40a2d10..be28707 100755 (executable)
@@ -2,9 +2,14 @@
 
 set -e
 
+DIR="$HOME/var/log/dmesg"
+FILE="$DIR/error.log"
+
+mkdir -p "$DIR"
 sleep 3 # wait for dunst to hopefully restart
-sudo dmesg --follow --level=emerg,alert,crit,err --since=now \
-| while read line
+sudo dmesg --follow --level=emerg,alert,crit,err --since=now --ctime \
+| while read -r line
     do
         notify-send -u critical 'dmesg error' "$line"
+        echo "$line" >> "$FILE"
     done
index a021734..f5409c2 100755 (executable)
@@ -2,9 +2,14 @@
 
 set -e
 
+DIR="$HOME/var/log/dmesg"
+FILE="$DIR/warning.log"
+
+mkdir -p "$DIR"
 sleep 3 # wait for dunst to hopefully restart
-sudo dmesg --follow --level=warn --since=now \
-| while read line
+sudo dmesg --follow --level=warn --since=now --ctime \
+| while read -r line
     do
         notify-send -u low 'dmesg warning' "$line"
+        echo "$line" >> "$FILE"
     done
This page took 0.02958 seconds and 4 git commands to generate.