- Batch Script – Ribbon UI Customization: Take Ownership and Change Permissions of the CommandStore Subkeys in the Registry
- Batch Script – Sending Items to the Recycle Bin Without Calling Any Third-Party Applications
- Batch Script – Zip/Compress Files Without Calling Any Third-Party Applications
- Batch Script – How to Check if the Current User is a Member of a Group
- Cannot Log onto Windows – Trust Relationship Failed
- Carrier Access Adit 600 – Reset to Factory Defaults
- Cisco SPA Series IP Phones – How to Backup and Restore a Config
- Cisco SPA500S Excel Sidecar Template
- Cisco VPN Client Won’t Connect on Windows 7 x64 via 3g Modem
- Classic Shell – Pin Items to the Classic Start Menu via Group Policy
- Classic Shell – Registry Entries for Custom Windows 7 Style Start Menu
- Classic Shell – Remove First Run Wizard with Group Policy
- Configure NTP Peers for Windows Time Service
- CryptoWall 3.0 Ransomware – Ouch, It Hurts So Good…Get Out the Backup Tapes. You’ve Got Those Right?
- Enable Clock via Group Policy on a Terminal Server
- Exchange 2010 – Add Send As Permission for All Users/Future Users from a User Account
- Exchange 2010 OWA – Can’t Delete Messages
- Exchange 2010 OWA – Mailbox is Disabled
- Exchange 2010 OWA – Outgoing Attachments Not Visible in Compose New Message Window
- Exchange 2010 OWA – Remove Cached Email Recipients/Auto Complete Entries
- Exchange Server 2010 – Changing Message Tracking Log Retention Period
- Exchange Server 2010 – Export Message Tracking Log Results to CSV File
- Exchange Server 2010 – Get a List of All Mailbox Columns/Attribute Names
- Exchange Server 2010 – Get a List of Mailboxes by Creation Date
- Exchange Server 2010 – Get a List of Mailboxes by Size
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"