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
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