1
0
mirror of https://github.com/morrownr/8821cu-20210916.git synced 2024-11-25 14:54:31 +00:00
8821cu-20210916/save-log.sh

38 lines
655 B
Bash
Raw Normal View History

#!/bin/sh
2023-01-27 05:47:52 +00:00
2022-11-17 14:26:57 +00:00
# Purpose: Save a log file with RTW lines only.
#
# To make this file executable:
#
# $ chmod +x save-log.sh
#
# To execute this file:
#
2023-02-12 23:36:39 +00:00
# $ sudo ./save-log.sh
#
# or
#
# $ sudo sh save-log.sh
2023-01-27 05:47:52 +00:00
SCRIPT_NAME="save-log.sh"
if [ "$(id -u)" -ne 0 ]; then
2022-11-17 14:26:57 +00:00
echo "You must run this script with superuser (root) privileges."
echo "Try: \"sudo ./${SCRIPT_NAME}\""
exit 1
fi
2023-01-26 17:52:27 +00:00
# deletes existing log
2022-11-17 14:26:57 +00:00
rm -f -- rtw.log
dmesg | cut -d"]" -f2- | grep "RTW" >> rtw.log
RESULT=$?
if [ "$RESULT" != "0" ]; then
2022-11-17 14:26:57 +00:00
echo "An error occurred while running: ${SCRIPT_NAME}"
echo "Did you set a log level > 0 ?"
exit 1
else
echo "rtw.log saved successfully."
fi