building a better atq

I was frustrated at the poor information available by atq (what’s that? You’ll tell me WHEN you’re running stuff, but not WHAT you’re running? This seems a little out of order!)

In fact, atq is literally out of order – I guess the idea is that you pipe it through sort. very very old-school thinking :)

At the other end of the scale, at -c provides an information overload of EVERYTHING about the job. (60+ lines of env? yikes. I don’t need to know that most of the time!)

So where is the simple and useful summary that I’d genuinely expect of atq?
ie, not only the queued command times, but WHAT those commands are – one per line.

As a result, here is my simple “batq” – a better atq :)

#!/bin/bash

# a better atq
#
# returns the original atq output in bold
# AND IN ADDITION, ALSO:
# * returns items sorted
# * the intended working directory
# * the command to be run
#
        # TODO:
        # $command is not robust - will fail on multiple lines

function do_extraqinfo() {
    while read job ; do
        jobid=$(echo $job | awk '{print $1}')
        detail=$(at -c $jobid)
        dir=$(echo "$detail" | egrep ^cd | sed -e 's/cd \(.*\) || {/\1/g')
        command=$(echo "$detail" | tail -1)
        # alter the following line if the bold offends you
        tput bold ; echo -n "$job" ; tput sgr0
        echo "  $dir    $command"
    done
} 

atq | sort | do_extraqinfo

What is wrong with the Geek Pride Manifesto

So, May 25 huh? Geek Pride Day! Or… is it?

The wikipedia article on Geek Pride day lists a “manifesto” of sorts, or a “geek code”(see below) for Geek Pride Day…

…here it is:

Rights:

  1. The right to be even geekier.
  2. The right to not leave your house.
  3. The right to not like football or any other sport.
  4. The right to associate with other nerds.
  5. The right to have few friends (or none at all).
  6. The right to have as many geeky friends as you want.
  7. The right to be out of style.
  8. The right to be overweight and near-sighted.
  9. The right to show off your geekiness.
  10. The right to take over the world.

Responsibilities:

  1. Be a geek, no matter what.
  2. Try to be nerdier than anyone else.
  3. If there is a discussion about something geeky, you must give your opinion.
  4. To save and protect all geeky material.
  5. Do everything you can to show off geeky stuff as a “museum of geekiness.”
  6. Don’t be a generalized geek. You must specialize in something.
  7. Attend every nerdy movie on opening night and buy every geeky book before anyone else.
  8. Wait in line on every opening night. If you can go in costume or at least with a related T-shirt, all the better.
  9. Don’t waste your time on anything not related to geekdom.
  10. Try to take over the world!

So, I have a problem with this. Not all of it, and mostly the ‘responsibilities’ section…

But I get ahead of myself. Here is where I disagree with the rights…

Continue reading