Add cleanup message and option to keep temporary pcap file

- Show message when deleting temporary pcap file
- Add KEEP_PCAP environment variable option to keep the file for analysis
  Usage: KEEP_PCAP=1 sudo ./test_monitor_tshark.sh wlan0 36 10

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Robert McMahon 2026-02-13 14:10:36 -08:00
parent 84a16cf62b
commit 73358f9223
1 changed files with 7 additions and 2 deletions

View File

@ -161,8 +161,13 @@ CAPTURE_OUTPUT=$(tshark -q -r "$TEMP_PCAP" -n -T fields \
-e radiotap.present \ -e radiotap.present \
2>/dev/null || true) 2>/dev/null || true)
# Clean up temp file # Clean up temp file (unless KEEP_PCAP is set)
rm -f "$TEMP_PCAP" if [ -z "${KEEP_PCAP:-}" ]; then
echo "Cleaning up temporary pcap file: $TEMP_PCAP"
rm -f "$TEMP_PCAP"
else
echo "Keeping temporary pcap file: $TEMP_PCAP"
fi
# Force output flush # Force output flush
sync sync