mirror of
https://github.com/kevinveenbirkenbach/dmesg-continuous-logger.git
synced 2024-11-22 05:11:02 +01:00
22 lines
351 B
Bash
22 lines
351 B
Bash
#!/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
|