Beep Beep Beep… Beep Beep Beep

HP-UX 11.x has an annoying “feature” that if the machine is booted headless (no kb/monitor) it beeps incessantly. Now that my visualize C3000 workstation has HP-UX running smoothly on it I’ve move it to the closet in my office to free up some space in the office. That worked fine except once I had the system without a monitor it was beeping 3 times every 15 seconds. A quick search of the hp-ux docs I have here gave me this little nugget to disable dtlogin. (no point in a graphical login if it’s in the closet)

/usr/dt/bin/dtconfig -d

If I decide to re-enable the graphical login again I can simply do a:

/usr/dt/bin/dtconfig -e

Just thought I’d share that tidbit as it was driving me batty for 10 minutes.

DST updates for freebsd

Those of you out there running older freebsd machines that require an update for the new DST can find the update timezone files under /usr/ports/misc/zoneinfo. To find out if you need the update, run this from the command line:

zdump -v /etc/localtime | grep 2007

It should report:

/etc/localtime Sun Mar 11 05:59:59 2007 UTC = Sun Mar 11 01:59:59 2007 AST isdst=0 gmtoff=-14400
/etc/localtime Sun Mar 11 06:00:00 2007 UTC = Sun Mar 11 03:00:00 2007 ADT isdst=1 gmtoff=-10800
/etc/localtime Sun Nov 4 04:59:59 2007 UTC = Sun Nov 4 01:59:59 2007 ADT isdst=1 gmtoff=-10800
/etc/localtime Sun Nov 4 05:00:00 2007 UTC = Sun Nov 4 01:00:00 2007 AST isdst=0 gmtoff=-14400

If it doesn’t report march 11th and nov 4th make sure your ports tree is current and do the following:

cd /usr/ports/misc/zoneinfo
make install && make clean
tzsetup

Choose your local timezone in here and accept the changes. Then re-run the above zdump command. If it reports March 11th instead of April 1st you’re good to go.

HP C3000 Workstation with HP-UX 11.i

So I managed to win an auction on ebay for an HP C3000 PA-RISC processor based workstation. I’ve been wanting to dabble in HP-UX for some time now (along with OS/400 and AIX) and since HP-UX requires special hardware I haven’t had a chance to work with it. I managed to get two C3000 workstations complete with 1GB ram each and 18GB SCSI disks for $170 cdn! considering they retailed for roughly $18K cdn each when they were new (2001) it’s a pretty good deal.

I’m going to pick them up this weekend, I can’t wait. Although I read that HP-UX is a bit of a hobbiest nightmare due to the restrictive licensing, I hope to get a running copy of HP-UX 11.i on one of them ASAP. If nothing else I will run PA-RISC linux on them and use them as servers/nerdy workstations.

Next I just have to get my hands on an RS6000, then my UNIX ninja training camp will be complete.

HP C3000
HP C3000

Remove comments and blank lines from a file

Want to make that httpd.conf look clean and tidy? Have a file that contains a lot of blank lines or comments that you don’t want? Here’s a quick trick to remove all the extra cruft.

Say I have a file called config.conf. This file looks like this:
-bash2.05b cswanson@helios ~ % cat config.conf
# Sample config file!

# Here is a sample comment. Note the blank lines.

$config=/etc/blah
echo $config $1

# Here is some more sample comments.

Now we run egrep on the file to remove the commented and blank lines:

-bash2.05b cswanson@helios ~ % egrep -v '^$|^#' config.conf
$config=/etc/blah
echo $config $1
-bash2.05b cswanson@helios ~ %

If you want to save this output to a file just use a simple redirect:

-bash2.05b cswanson@helios ~ % egrep -v '^$|^#' config.conf > config.conf-new
-bash2.05b cswanson@helios ~ % cat config.conf-new
$config=/etc/blah
echo $config $1
-bash2.05b cswanson@helios ~ %

UPDATE: If you’re using vi you can use the following commands to achieve the same thing.

Remove blank lines:
:g/^$/d

Remove commented lines:
:g/^\s*#/d

Of course there are other ways to skin this cat using sed/awk etc but the above two commands have proven to be quick and easy for me.

CMD.exe on steriods!

Windows command console (cmd.exe) hasn’t changed much since it was first introduced in the original windows NT. When you use command shells on unix all day and try to work in cmd.exe it’s like going back in time 10 years! Basic things like tab completion (I know you can enable it in the registry), tabbed windows and a resizable window are sorely lacking. Sure there are some powerful things you can do on the windows command console but these are all separate programs and not really a part of the command console it self.

What windows needs is a good command console replacement, that’s where Console2 comes in. Console2 beta is a free replacement for cmd.exe. It’s still in beta but I’ve been using it for almost 2 months now without a problem. It makes the windows command line usable.

Of course, if you’re having a problem transitioning from UNIX to DOS and can’t stop doing ls when you should be doing dir then you need to get cygwin!