Friday, October 19, 2007

Senior Project--Linux appliance

I am not ashamed to admit it...OK, maybe a little ashamed...
I'm 31 years old and have been working on a 4-year degree since 1994. Now, I took a couple years off to serve as a volunteer missionary, then another year after I got my Associate's Degree. I changed schools, then got hired back at the place I got my A.S. as a network engineer. Since then (2001) I've been taking about 6 credits at a time in pursuit of a Computer Science degree.

Anyway, I'm now just a few credits away. For my senior project I'm putting together a Linux-based appliance for a company that wants to do monitoring of their WLAN devices. There's a lot more to it than just the OS, but maybe I'll get to that later.

For the OS, I started out with Ubuntu (at the company's request). I have been working to trim it down, but I am having a hard time getting it to under 100MB without breaking it. I am considering building a busybox system, but don't know if that will meet the company's requirements and needs. I've also considered modifying DSL or finnix.

Right now I'm building a LFS system, mostly for the experience and knowledge of what a base Linux system is really made of. I also ran across DFS, which looks kind of promising, but not much more than Ubuntu.

I'm just having a hard time deciding which road to take. One key thing is that I have to provide a system for the developers to easily update and change whatever I build. Another thing is that the entire OS is supposed to be stored on a CF card and loaded into a ramdisk on boot. All data will be stored to a RAID array. If anybody has comments, links, advice, I'm all ears. I've spent about 75 hours on the project doing research, testing, requirements gathering, and documentation and I have about 125 to go.

Run monitoring program in a TTY

I remembered seeing something really cool in a live CD distro. On some TTYs they ran some nice monitoring programs so that I could keep an eye on system resources just by switching to a TTY. I finally got around to looking it up.

First, install htop, which is like top on steroids. In a Debian-based system, run:
apt-get install htop

To run htop whenever the system boots, you need to modify one file. In a traditional SysV init system, you can place a line like this in inittab:
6:2345:respawn:exec /usr/bin/htop >/dev/tty6 </dev/tty6

If you're running a distro that uses Upstart, like later Ubuntu releases, then put this in /etc/event.d/tty6:
start on runlevel 2
start on runlevel 3

stop on runlevel 0
stop on runlevel 1
stop on runlevel 4
stop on runlevel 5
stop on runlevel 6

exec /usr/bin/htop >/dev/tty6 </dev/tty6

Now issue:
sudo kill -HUP 1

[Edit] or alternatively:
sudo stop tty6; sudo start tty6

Press Ctrl-Alt-F6 and you'll see a very cool system monitor. Some other options for monitoring include:
exec /usr/bin/top d 1 s S c >/dev/tty6 </dev/tty6 # Classic top
exec /usr/sbin/iftop -i eth1 >/dev/tty6 </dev/tty6 # Monitor network interface

Keep in mind that if you want to run more than one, you'll have to put each one on a different TTY. Have fun!