Skip to content

Instantly share code, notes, and snippets.

@jeffgeiger
Last active August 29, 2015 14:10
Show Gist options
  • Save jeffgeiger/f3c0d3fb91d5d643cce6 to your computer and use it in GitHub Desktop.
Save jeffgeiger/f3c0d3fb91d5d643cce6 to your computer and use it in GitHub Desktop.
Cleanup script for files and logs in ROCK
#!/bin/bash
DATEDIR=$(date +%Y-%m-%d_%H:%M:00)
BRO_FILES_DIR="/capes/bro/extract"
BRO_FILES_ARCHIVE="/capes/bro/extract/${DATEDIR}"
PCAP_FILES_DIR="/pcap/"
PCAP_FILES_ARCHIVE="/pcap/${DATEDIR}"
mkdir -p $BRO_FILES_ARCHIVE
mkdir -p $PCAP_FILES_ARCHIVE
find $BRO_FILES_DIR -maxdepth 1 -mindepth 1 -type f -mmin -61 -a -mmin +1 -exec mv '{}' $BRO_FILES_ARCHIVE/ \;
find $PCAP_FILES_DIR -maxdepth 1 -mindepth 1 -type f -mmin -65 -a -mmin +5 -exec mv '{}' $PCAP_FILES_ARCHIVE/ \;
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment