#! /bin/bash # Script will be excuted by tcpdump -z option og_filename="$1" timestamp=$(stat -c %Y "$og_filename") compressed_filename="${og_filename}_${timestamp}.pcap.zst" # If compressed file exist with same base as og file, it means tcpdump rotate made one turn # So delete it manually as tcppdump is not aware of compressed file rm -f "${og_filename}"*.pcap.zst # Compress og file and delete it zstd "$og_filename" -o "$compressed_filename" --rm