- Mac OS X – Export Google Chrome Browsing History to CSV File from the Terminal
- Mac OS X – Force Spotlight Search to Index a Network Folder
- Mac OS X – Install Yosemite/El Capitan via USB Thumb Drive or How to Get the DMG Image
- Mac OS X – Install Zabbix Agent from Source
- Mac OS X El Capitan – Cannot Restart into Boot Camp Partition
- Manually Restore a Clonezilla Image When Destination Partition is Smaller than the Original
- Mikrotik Scripting – Array Pop Function
- Mikrotik Scripting – Array Push Function
- Mikrotik Scripting – Function to Split an IP Address into an Array
- Mozilla Firefox 51.0.1 Runs Extremely Slow
- MySQL Script – Alter/Convert All Tables in a Database from MyISAM to InnoDB
- NextCloud – Purge Music Library from DB
- NextCloud – Rescan Music Library for All Users
- OpenMCU-ru – DSCP Based QoS Packet Tagging Rules for Linux IP Tables
- Outlook 2010 – Crashes Upon Opening Emails with Embedded Pictures
- Outlook 2010 – Only Starts in Safe Mode
- Outlook 2010 Hijacked
- pcapsipdump – Dump SIP Signalling and RTP Streams Per Call Leg into Separate Pcap Files
- PHP – Simple PDO Class for Connecting to a MySQL Database
- Playstation 4 – Cannot Connect to the PSN Using Comcast Gateway
- Polycom RealPresence Desktop – Do Not Minimize to Taskbar Tray
- Polycom RealPresence Desktop – Windows QoS Registry Settings
- PowerShell Script – Generate DFS-R Health Reports and Email Them
- Putty – Import/Export Your Saved Sessions List and Settings
- Raspbian – How to Run X11vnc on Startup
Bash Script – Pcapsipdump Spool Directory File Rotation – OR – Rotate Directories Based on YYYYMMDD Format
In the config file for the pcapsipdump program, there is a retention option where you are supposed to be able to enter the number of days to keep the directories in your spool folder and it should auto purge out the old directories/files, however, this option either doesn’t appear to be implemented yet or doesn’t work if you run the app as a different user (could be a permissions issue maybe?).
Anyhow, this script is my solution to the problem. It could also very easily be modified and used where someone needs to search and delete directories that are based on YYYYMMDD format with the ability to whitelist or ignore certain directories, hence the alternate title. Yet another alternate title could even be “Bash Script Functions – Convert YYYYMMDD to Unix Time and Vice Versa” but obviously the script would need modified a little because it has been tailored to fit my needs.
When run as a cron job, the script will grab both the spool directory and the retention period from the pcapsipdump config file and will purge out any old folders based on YYYYMMDD format so they aren’t eating up all your valuable disk space.
I also added a couple of noteworthy user-configurable options. The first being a directory whitelist feature (IGNORE_DIRS array), this option can be used in situations where there are directories that you don’t want purged or would like to keep the data indefinitely and that can also be used in conjunction with the PURGE_ALL feature to delete out any subdirectories that aren’t specifically listed in the whitelist if you are a clean freak.
Download it now – pcaprotate.sh
#!/bin/bash # # pcapsipdump file rotation # By Nathan Thomas # 12/05/2014 # ### VARS ### # Location of the pcapsipdump config file CONF_FILE='/etc/default/pcapsipdump'; # Keep the spool folder clean - Delete all folders (except those in the ignored directories array) # yes - Keep the spool folder free from any directories not in the ignore list # no - Don't worry about any other random folders in the spool directory Continue reading "Bash Script – Pcapsipdump Spool Directory File Rotation – OR – Rotate Directories Based on YYYYMMDD Format"