Tag Archives: cli

Monitor Directory for Changes

Here’s a simple script that I setup for my development WSGI server to reload itself once changes in source code are detected:


while true; do
    A=`find $1 -printf '%t' | md5sum`;
    sleep 1
    B=`find $1 -printf '%t' | md5sum`;
    if [ "$A" != "$B" ]; then
        echo "Detected change, doing: $2"
        eval $2

It’s very simple (a poor-man’s replacement for inotify) and doesn’t do anything complicated. Usage ./monitor.sh application "my-reload-services.sh". You can filter out unwanted stuff like maybe *.swp files by referring to the man find pages.

What do you use to monitor for changes? How can the above script be improved?

Cross-server deployment with servermattic

About a week ago I did a post on Tiny Projects Inspired by WordPress. Readers who actually visited the Code.WordPress Trac would have noticed a tool called servermattic, which is described modestly as “install files and applications to many servers according to their role“.

What is servermattic?

servermattic is a template configuration that allows for deployment of code and configurations across multiple servers – write once, deploy on many machines, update as much as you want with revisions.

Continue reading

Tiny Projects Inspired by WordPress

WordPress development has inspired core developers to code up some interesting utilities, tools and toolchains to aid in the deployment and development processes. Like the notorious `bumpbot` (compresses scripts and styles, bumps their version numbers) and `potbot` (generates pot files), there other at least a dozen other tools that are not only useful, but open-source and available for download.

Tiny Projects Inspired By WordPress

Ready to look into some of the most interesting ones?

Continue reading

ack-grep vs. grep

Following Daniel Bachhuber – The Zen of WordPress Development talk, I’ve started to explore this magical ack tool, a replacement for the native grep.

ack vs. grep

ack can be downloaded from the official and quite modest website called BetterThanGrep.com. ack is also available in all sorts of software repositories, and can be named ack-grep instead (due to a naming conflict).

ack is written in Perl, while grep is written is C. So why the heck does ack appear to be faster? Here are some test with the latest WordPress package.

Continue reading

WordPress Command Line Fun

Many of you may have already met the WordPress Command Line tool called wp-cli by @scribu, the man who eats WordPress for breakfast, but my first encounter with the tool happened a couple of days ago. I don’t know how in the world I had missed its announcement 4 months ago.

wp-cli WordPress Command Line

About the tool

The WordPress Command Line tool provides a command line interface for administrative control and management, and even installation of WordPress. The tool is written in PHP and makes use of the highly flexible and powerful PHP Command Line tools library. It requires PHP CLI SAPI to be installed on the machine, which will almost always be available if you’re running WordPress on the server.

Continue reading

Command Line Android Development: Basics

Although the Android ADT plugin in Eclipse provides some of the fanciest and most convenient development tools, with its graphical interfaces for resource editing, for one, and the million and one Eclipse IDE features on top of it all, I prefer to handle things at a lower level. There’s much more to learn from hitting the docs than to hit “Import missing packages” and “List override methods”, isn’t there?

Command Line Android Development

Continue reading