Insights on Ruby, Git, jQuery, Cappuccino, WordPress, Debian and OS X. Please subscribe if you find something useful!

Self-Scheduling Ruby Scripts

Posted: August 20th, 2009 | Author: Jerod | Filed under: Ruby | Tags: , | Comments

Whenever is an awesome library that:

“provides a clean ruby syntax for defining messy cron jobs and running them Whenever.”

Whenever has become very popular for use with Rails apps and there are plenty of tutorials on how to use it. This RailsCast is a good place to get started if you’re interested in that.

However, I haven’t seen too many people writing about using the library outside of Rails (or other web frameworks).
Read the rest of this entry »


2>&1

Posted: March 17th, 2009 | Author: Jerod | Filed under: Debian | Tags: | Comments

A common practice when adding entries to crontab is to end the entry like this:

 >/dev/null 2>&1

The purpose of this is to suppress any output from the command itself, because we’re not interested. I picked up this syntax years ago because it just works, but I never knew what the ‘2>&1′ actually meant, until today.

The first part:

 >/dev/null

Means redirect STDOUT (the standard output stream) to /dev/null (which is basically a blackhole for bits). That’s easy enough.

The second part:

 2>&1

Means redirect STDERR (standard error stream) to the same place as STDOUT (which was just specified). STDOUT has the assigned number 1 and STDERR has the assigned number 2.

This way both STDOUT (1) and STDERR (2) are directed to /dev/null and all output of the cronned command is suppressed.