WordPress OS Disk Cache Report, Prime and Flush

I wrote a bash script this morning to report the size of Wordpress cache folders, the number of files they contain, read each file to prime the OS disk cache, and optionally flush the OS disk cache as well. This might be a script you could execute to email a daily/weekly report of cache folder sizes, or perhaps execute during/after booting a server to prime the OS disk cache, or even on a regular schedule to make sure the OS cache is always primed.


Memcached vs Disk Cache

I recently added some disk caching for MySQL queries, Wordpress objects, PHP opcode, and PHP web pages on my server. There are several different caching techniques and applications available, and memcached seems like one of the more popular ones. Right or wrong, it appears to be the default go-to for many developers these days. Since I’m a SysAdmin by profession (with maybe a penchant for scripting and integration), I tend to have a more “systems” oriented approach — which led me to first consider, and then choose disk caching over memcached. In this post, I’ll outline the reasons I chose disk caching, and why in most circumstances it might be superior to memcached.


Quick Freeze / Thaw of Reverse Zones

I had to update several reverse zone files today, so wrote a quick for-loop in bash to freeze and thaw all the zones. The script parsed the zone file names and reversed them into a proper d.c.b.a.in-addr.arpa format. Later I tweaked it with sed to make it more flexible (in order to pass it a full or partial IP address), but ended up using tac for the reversing part instead – that’s what it’s made for after all. And if you’re wondering what tac stand for, just read cat backwards. :-)


Create and Update OTRS Tickets from the Command-Line

I recently wrote a notification script for Centreon / Nagios to create and update tickets in OTRS. The ticket details and OTRS connection settings are all defined on the command-line. The Log::Handler module allows the script to output and log different amounts of activity detail, and the DBD::SQLite module is used to keep a local database of the Ticket ID (from OTRS) and the Problem ID (from Centreon / Nagios) associations — so the OTRS ticket can be updated with follow-up notifications from Centreon / Nagios for the same issue.