2023-01-27 10:16:08 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-10-27 12:51:22 -05: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-24 14:14:49 -06:00
|
|
|
# $ sudo ./save-log.sh
|
|
|
|
#
|
|
|
|
# or
|
|
|
|
#
|
|
|
|
# $ sudo sh save-log.sh
|
2023-01-27 10:16:08 -06:00
|
|
|
|
|
|
|
SCRIPT_NAME="save-log.sh"
|
|
|
|
|
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
2021-10-27 12:51:22 -05:00
|
|
|
echo "You must run this script with superuser (root) privileges."
|
|
|
|
echo "Try: \"sudo ./${SCRIPT_NAME}\""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-01-27 10:16:08 -06:00
|
|
|
# deletes existing log
|
2021-10-27 12:51:22 -05:00
|
|
|
rm -f -- rtw.log
|
|
|
|
|
2023-07-20 15:11:40 -05:00
|
|
|
dmesg | cut -d"]" -f2- | grep -i RTW >> rtw.log
|
2021-10-27 12:51:22 -05:00
|
|
|
RESULT=$?
|
|
|
|
|
2023-01-27 10:16:08 -06:00
|
|
|
if [ "$RESULT" != "0" ]; then
|
2021-10-27 12:51:22 -05:00
|
|
|
echo "An error occurred while running: ${SCRIPT_NAME}"
|
|
|
|
echo "Did you set a log level > 0 ?"
|
|
|
|
exit 1
|
|
|
|
else
|
2023-07-20 15:11:40 -05:00
|
|
|
# dmesg | cut -d"]" -f2- | grep -i USB >> rtw.log
|
2021-10-27 12:51:22 -05:00
|
|
|
echo "rtw.log saved successfully."
|
|
|
|
fi
|