From 3bb91cbb1760a5ae00bfa5f7a30b7aab21f2154a Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 23 Aug 2023 16:17:09 +0200 Subject: [PATCH] Create capture_dmesg.sh --- capture_dmesg.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 capture_dmesg.sh diff --git a/capture_dmesg.sh b/capture_dmesg.sh new file mode 100644 index 0000000..851a9df --- /dev/null +++ b/capture_dmesg.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Specify the log file name +LOGFILE="dmesg_continuous.log" + +# Function to cleanup on exit +cleanup() { + kill $DMESG_PID +} + +# Start capturing dmesg in the background +dmesg -w > "$LOGFILE" & +DMESG_PID=$! + +# Trap to cleanup on script exit +trap cleanup EXIT + +# Keep the script running until manually stopped +while true; do + sleep 1 +done