I'm trying to have a cronjob
convert files with tshark
.
This is my script so far:
files=$(find /home/user/traces/*.pcap -mmin +10 -type f)
echo "$files" | tshark -r - -T ek > '/home/user/traces/converted/'-.json
I'm trying to convert files older than 10 minutes, and put them in converted
folder.
But it fails with:
tshark: The standard input isn't a capture file in a format TShark understands.
I think the passing of filenames to tshark
fails, but not sure.
For reference, this single command does work:
tshark -r /home/user/traces/trace.pcap -T ek > /home/user/traces/converted/trace.pcap.json
UPDATE
Seems to work with for loop:
files=$(find /home/user/traces/*.pcap -mmin +10 -type f)
for file in $files
do
echo "processing file: $file"
tshark -r $file -T ek > "$file.json"
done