Where I work, we have about thirty networked printers that we manage with CUPS.  When CUPS encounters something it doesn’t like, it has a tendency to shut down the affected queue.  Sometimes this happens when the server can no longer communicate with the target printer.  Sometimes, it happens when a job is submitted with a bad print driver.  There have been a few occasions when I’m fairly certain that gremlins were to blame.  Whatever the reason, when the queue gets disabled, people can still print to it, but the jobs just pile up.

You might expect that people would complain quickly when their print jobs come out.  That’s not always the case.  Earlier this week, one of the most heavily-used printers was disabled for about a day before anyone brought it to my attention.  By that time, tens of jobs were waiting, and it took over an hour (and a few paper refills) for them all to come out.  A quick “cupsenable” is all it takes to fix the problem, so there’s no reason to wait for it to get worse.

Today, I wrote a script (below) to monitor the queues and send a notification to our ticket system if one is down.  I considered having it run cupsenable first, but I decided it would be better to not mask the problem.  My wife wisely pointed out that if one particular queue is failing regularly, it might be worth knowing about.

#!/bin/bash
# check_cups
#
# Ben Cotton - 2009
#
#  Checks the status of the CUPS queues and notify if one is down
#
# The queues we want to check
queues=`lpstat -a | awk '{print $1}'`
# The e-mail address to notify when a queue goes byebye
toEmail='help@example.com'
# The e-mail address to use as the 'from'
fromEmail='cups@example.com'
# The directory to keep the lock files
lockDir='/var/run'
# The host to say we're complaining about
hostName=`hostname | awk -F. '{print $1}'`
# Where is mail?
mail='/bin/mail -s'
# Check the queues
for queue in $queues; do
lpq -P $queue | /usr/xpg4/bin/grep -q " not "
if [ $? -eq 0 ]; then
# Have we already complained about this queue?
if [  -a $lockDir/check_cups.$queue ]; then
true
else
touch $lockDir/check_cups.$queue
$mail $toEmail <<EOF
To: $toEmail
From: $fromEmail
Subject: Print queue $queue on $hostName down
The print queue $queue on host $hostName appears to be down.
EOF
fi
else
# The queue is up, check to see if it wasn't previously
if [ -a  $lockDir/check_cups.$queue ]; then
rm  $lockDir/check_cups.$queue
fi
fi
done

The Internet is for…

…comics. Avenue Q fans may have a different way to end that sentence, but I try to keep this a family-friendly blog. Part of my daily routine is the reading of several comics, both traditional and web. I thought it might be fun to share the comics that I read and see what else my ones of readers enjoy. Also, it is good filler so that it looks like I’m actually writing content for my blog. 🙂

On the bus ride to work each morning, I read the comics in the newspaper. My favorite is definitely “Pearls Before Swine”, although “Sally Forth” is my guilty pleasure of late. “Close to Home” and “Rhymes with Orange” have a bit of a Larson-esque taste for the random and absurd, but they are both very hit-or-miss. “Crankshaft”, “Family Circus”, and “Garfield” are all too un-funny to be on a page called “Comics”, and “Mallard Fillmore” could provide some nice political humor, except the writer clearly doesn’t feel it is worth the effort.

But this post is in the “The Internet” category, so I should really talk but the web comics I read…

  • Real Life Comics – Real Life is a comic that my wife got me reading several years ago. It stars the author, Greg Dean, and his friends. Mostly, they’re in daily real-life situations (hence the name), but there are occasional forays into a sci-fi fantasy world, generally revolving around some nefarious plot by his friend Tony. In my opinion, this comic is a mere shadow of its former self, but it is still good for a laugh. Admittedly, I don’t get a lot of the video game jokes, but those seem to be fewer these days.
  • Piled Higher and Deeper – I came across this comic when it was plastered all over several doors in the Physics Building on campus. I stopped to read them (better than going to class, right) and thought it was funny enough to find on the Internet. PhD was started several years ago by Stanford grad student Jorge Cham. He still writes the comic, but the updates seem rather sporadic. Despite having never been a grad student, I feel like I get most of the jokes, but if you pick up reading this, it behooves you to start from the beginning, so that you get a true feel for each of the characters.
  • XKCD – No, the letters don’t mean anything, but XKCD may be the most celebrated comic in all of nerd-dom. The math is sometimes a bit over my head, but by-and-large the jokes are just nerdy enough. Several of Randall Munroe’s efforts grace my office door, and just about every admin I know secretly longs to use sudo make me a sandwich (funny story: one of my student workers tried that on his girlfriend, and it worked…but only once). Although it is generally only updated on Monday, Wednesday, and Friday, I still check every day, just to be on the safe side. A piece of advice for those of you who may not be regular readers: hover your mouse over the image, the tool tip is often the most humorous part.
  • Questionable Content – This is another comic that I’ve begun reading thanks to my Dearest. Despite the name, the content of this comic is generally safe for work. Still, if you have children, you might want to wait until they’re old enough to go behind your back before you allow them to read it. Jeph Jacques produces a fairly artistic comic about the daily lives of a group of friends. I really hope all of the characters are invented, because if they aren’t, that guy needs to move. I think I like this comic because I feel like it could be about me, if I was a little cooler and way more indie.
  • Dinosaur Comics – This is a comic that seems to have a rather narrow appeal. I enjoy it, but it seems that no one else I know does. Maybe it’s because T-Rex reminds me of my friend Tom, or maybe it’s because the art never changes. No matter what the reason, only Dinosaur Comics can sexualize literary techniques. My only complaint is that it seems to update rather late in the morning, so I either have to go back and re-check it, or I have to be a day behind. That could be because Ryan North is allegedly a Canadian.
  • Cyanide and Happiness – The most recent addition to my daily routine is this not-safe-for-your-kids-or-grandmother masterpiece. No joke is too offensive, too crude, or too funny. I blame Reddit for this one, although my friend Andy would probably have clued me in eventually. This is another comic that you either get or don’t, and I’m fairly sure I’m going straight to hell for laughing at it.

More quota problems

The folks at Brainy Quote tell me that Jacques Santer once said “A quota is always something artificial that can only last for a certain period of time.” Monsieur Santer was clearly never a sysadmin. A quota may be artificial, but it is inviolate and lasts forever.

There are many reasons quotas may be enforced on a system. Perhaps because disk space is limited, or because a particular system is not designed to be a dumping ground for files. Or the admin could just be a real jerk and enjoy inflicting pain on his users. Whatever the reason, quotas always seem to be too small to please the users and can cause real problems when exceeded. I’ve mentioned in the past (here and here) about the woes of too-small quotas, but the latest example is perhaps the most amusing.

A graduate student sent in a request saying that the GNU Ghostview (ggv) program would not zoom in on documents. Apparently it did at one time, but no longer. (For a year or so, she says, which is a long time to not complain about something.) That seemed like a rather odd issue, so I did the basic troubleshooting. I created a PostScript and a PDF file and tried to view then in ggv. Once they loaded, the zoom worked just fine. So I ssh’ed into her machine and tried again. Still no problem. So it must be something specific to her account.

I checked her quota. She was near, but not over, so I suggested she should perhaps clear some space. I also asked her to send me her .cshrc so I could replicate her environment. Nothing looked suspect in her .cshrc file, so it came as no surprised that when I used that, I was still unable to reproduce the problem. I even tried opening a couple of files she was having problems with — maybe my files were simple enough that they wouldn’t be an issue? Nope.

After a few back-and-forths, she tells me that ggv won’t even open now. So I have another look at her quota. This time, she’s well over the limit, and once she reduced her disk usage, suddenly ggv could zoom in on files again.

So why does this happen? I can only assume ggv needs to write some temporary files when it zooms, and when you’re near quota it can’t. Of course, we said above that quotas are artificial. Disk space, however, is very real, and on a system with no quotas but a lack of disk space, you’ll see similar issues (and probably many others). Often when you’re at or near quota (or nearly out of disk), you won’t even be able to log in with a graphical session because your desktop manager won’t be able to write the temporary files it needs to operate.

What’s the lesson to be taken from this? In an environment such as mine, where the quotas are small and out of your control, always assume that an inexplicable problem with a graphical program is quota-related until you can prove otherwise.

Boiler breakdown

Welcome to the inaugural post in the “Sports” category. I forewarn you, I am a complete Purdue homer, but I do generally enjoy watching Big Televen basketball. I’ll try to keep things as unbiased as I can, but my ones of readers will have to forgive if I let my true colors show from time-to-time. Let’s get things started by talking about Purdue’s season so far.

After a few sad years in the middle part of the decade, I was really excited for this year’s Purdue team. Last year, with mostly freshmen and sophomores, the Boilermakers outperformed expectations, including a sweep of eventual conference champions Wisconsin. With all of the key players returning, including Preseaon Player of the Year Robbie Hummel and last year’s Defensive Player of the Year Chris Kramer, it was obvious that Matt Painter’s team was the favorite to win the conference title. So what has happened since then? The team is struggling to remain in contention for the title, and may realistically finish somewhere in the middle. Why?

  • Injuries – Robbie Hummel hurt his back early in the season. Last week it was revealed that he has a stress fracture in his L-5 vertebrae. Hummel has shown an amazing ability to play through it, but as the season has gone on it has become more obvious that he’s not playing as well as he could. He’s sat out the last two games, including today’s blowout loss in Champaign. Purdue has a lot of talent, but they’re just not the same team when Hummel is on the bench. In three of the four conference losses, Hummel sat out entirely, and in the opening loss to Illinois, he left the game on crutches. It looks like Hummel may not be back until tournament time, if even then, so this does not bode well for the remainder of the schedule.

    Robbie Hummel isn’t the only player to deal with injuries. Chris Kramer had his nose broken by Michigan’s Manny Harris, although that doesn’t seem to have slowed down his defense. Lewis Jackson suffered a concussion at the hands of Joe Krabbengoon in Wisconsin. Keaton Grant, JaJuan Johnson, and Jackson spent a week battling the flu.

  • Silenced shooters – Junior Keaton Grant and sophomore E’Twaun Moore shot very well last year. This year, they’ve been quiet for the most part. Especially in light of Hummel’s absence, Purdue can ill afford to have either of these guards not making shots. To have both of them silent has been brutal.
  • Running out of gas – With Hummel’s back and the various other injuries and illnesses, the players have been worn out. In the last two games, it was clear that the team was only able to play 30 minutes. This is where I blame Coach Painter, to some extent. Senior Bobby “Buckets” Riddell and freshman Ryne Smith aren’t as good as some of the other players on the team (although I think I’d pick either one of them over Marcus Green) but they could provide a few minutes of valuable rest to the rest of the team. It might not have mattered against Illinois, but it could have ended the game against The Ohio State University in regulation. Which brings me to
  • Overtime – I don’t know why, but Purdue has yet to win in overtime under Matt Painter. Does it have to do with running out of gas? Maybe. It could just be bad luck, but it’s a very disturbing trend. Certainly, this year’s team has to get it done in regulation.

So why might Purdue be okay going down the stretch?

  • Chris Kramer – I will freely admit to having quite a man crush on #3. One of the best defenders in the country, he sparks his teammates just by being on the floor. Although he’s been a weak presence on offense, his defense will be key to keeping Purdue in the game down the stretch.
  • JaJuan Johnson – What a difference a year can make. Johnson has gone from being a weak, scrawny post player to a great, scrawny post player. Johnson has had some big games, and he can battle anyone under the basket. His slight frame hasn’t kept him from getting several double-doubles in conference play. With the threat of JaJuan Johnson underneath, opponents must give a little extra room to the guards.
  • Schedule – Purdue faced a rough first half of the conference schedule, including games at Wisconsin, Penn State, Minnesota, and Ohio State. The remaining schedule keeps them in Mackey Arena for five of the last seven games, including what should be an absolute drubbing of Indiana. If the Boilers can win the remainder of their home games, then there’s still hope for a decent seed in the tournament.
  • Coaching – I know I gave Matt Painter grief above, but he is truly one of the outstanding young coaches in basketball. He can do a lot with a little (see: 2007 NCAA tournament) and I’m sure he hasn’t given up on hanging a 22nd banner.

The Big Ten conference is one of the toughest in the country this year, and there’s still a lot of basketball to be played. There are still several teams who could get hot and win the conference. We’ll find out in March.

Nugget Night update

Despite my intent to be more blogulicious, it has been a while since the last update. Fear not, friends, because more posts are forthcoming. In the meantime, please enjoy viewing the latest updates to the Nugget Night page. Those of you concerned for my well-being will be pleased to know that my annual wellness screening will be in a mere 10 days or so. I’ll report on the change in my cholesterol, and if I pass out or not. Oh shoot, I’d better go eat my oatmeal…