2023-01-25 12:57:32 +00:00
|
|
|
#!/bin/sh
|
2022-11-17 14:26:57 +00:00
|
|
|
#
|
|
|
|
SCRIPT_NAME="save-log.sh"
|
|
|
|
#
|
|
|
|
# Purpose: Save a log file with RTW lines only.
|
|
|
|
#
|
|
|
|
# To make this file executable:
|
|
|
|
#
|
|
|
|
# $ chmod +x save-log.sh
|
|
|
|
#
|
|
|
|
# To execute this file:
|
|
|
|
#
|
|
|
|
# $ sudo ./edit-options.sh
|
|
|
|
#
|
2023-01-25 12:57:32 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
# Deletes existing log
|
|
|
|
rm -f -- rtw.log
|
|
|
|
|
|
|
|
dmesg | cut -d"]" -f2- | grep "RTW" >> rtw.log
|
|
|
|
RESULT=$?
|
|
|
|
|
2023-01-25 12:57:32 +00:00
|
|
|
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."
|
|
|
|
exit 0
|
|
|
|
fi
|