Sysadmin Appreciation Day – July 31st

System Administrator Appreciation Day is July 31st. Stop by your sysadmin’s desk (heck, any of your IT department’s desks) and show your appreciation. Without them, you probably couldn’t get any work done, wouldn’t be able to get paid, and wouldn’t be able to get those funny pictures of ‘I can haz cheezburger’ cats in your email.

Pad a Numeric Field with 0 in DB2

Say you’re storing a time in a 6 position numeric field in DB2 (in HHMMSS format), and you need to pull the hour. SUBSTR(FIELD,1,2) will work great as long as the time is 10am or later, but before that, you’ll start pulling weird times like 91:00. This is because SUBSTR does not pad a numeric field with zeroes in query. To force a prepended 0, do SUBSTR(DIGITS(FIELD),1,2).

Backing Up with Virtualmin and S3

Virtualmin is a great open source server management tool. In fact, its what I use for my hosting. Amazon S3 is a great, affordable online storage service. What do you get when you combine them? A great way to back up your servers.

Virtualmin has had support for local and remote backups for some time now, but the idea of weekly 8GB FTP sessions to my home server doesn’t seem so grand (it would interrupt the Linux ISO torrents). So I signed up with S3, and for less than the cost of a egg mcmuffin, I can keep 4 weeks of full system backups available for restore at a moments notice.

This guide assumes you’ve got Virtualmin Pro (not sure if the free version does S3 – it does, give it a try!), and an active S3 account.

Continue reading

Bomb Threat Gone Stupid

From WOOD-TV:

“A man accused of calling in a bomb threat at a courthouse was arrested after being spotted in an elevator in the building.”

Long story short, this guy who was to be sentenced for credit card fraud decided that calling in a bomb threat to the courthouse was a smart way to delay his sentencing. He called in the threat from his house, and then showed up at the courthouse.

Of course, as soon as the threat came in, police traced the call to him and had his description.  As he tried to get off an elevator, he ran right into a Sheriff’s officer who was just handed a printout of his photo and his description.  The inevitable occurred, and he now faces additional charges with calling in the bomb threat.

Unused SQL Query

I was moving some of my code to .Net 3.5 earlier this week and cleaning up some of the migration issues. One of the warnings was that readJobs was an unused local variable. Not too unusual, till I found that it was this gem it was referencing:

Dim readJobs As SqlDataReader = cmdJobs.ExecuteReader(CommandBehavior.Default)
While readJobs.Read()
End While
readJobs.Close()

Removing or Changing the NBX 8 Pool

FlowerCo uses extensions which start with an 8 (well, technically they have 3 digit extensions internally and use 8 as a prefix on incoming calls). Switching them over to an NBX will be easy, except for the fact that by default, 8 prefixes are for the 8 pool, and extensions start at 1000.

Open up your dialplan and delete any TableEntrys which reference your 8 pool route, then update your ExtensionRange to include 8000 series extensions. If you want to maintain the functionality of the 8 pool, you can change it to use a 7 as the prefix by deleting references to the Diagnostics route in your initial tables, and replacing that TableEntry to be Local pointing to your 8 route

ExtensionRange Telephone 8000 8099
TableEntry Create 1 30 8 4 4 Internal  0 8
TableEntry Create 1 10 7 8 8 Local  0 1

Don’t forget to update your auto-discover settings to start assigning phones at 8000 (System-Wide Settings -> Enable Features System-Wide). If you want to remove the 8 pool entirely, just remove any of its entries in Table 1 and Table 2 of your dialplan.

Going Green in the Home Datacenter

If you’ve been to my place, you know my basement sounds like a hair dryer. I have 5 machines running 24/7 most of the time. Noise and electric bills finally got to me, so I picked up a Kill-A-Watt to track power usage, per machine. What I found out is that having those machines on constantly accounts for 1/3 of my electric bill, almost 330 kilowatt-hours per month.

The 2 biggest hits towards power usage were # of drives, and processor type. More drives = more motors to spin. The most power-hungry drives were the Ultra320 SCSI drives, followed by PATA drives and finally SATAs. Processor power usage seemed to follow a slightly different curve, with a 2nd gen P4 using the most power, followed by P3s, Pentium Ds, and the Core 2 Duo.

Continue reading