Tales of an IT Nobody

devbox:~$ iptables -A OUTPUT -j DROP

Command line musings: whiptail and dialog March 15, 2010

A quick jaunt on cool command utils for ‘command line ui’ installations/prompts for those who are into that kind of stuff for configuration tools, etc;

Whiptail
Whiptail is a handy utility that allows you to create colorized command line dialogs that you see when configuring certain things such as postfix or zend server, etc.

For scripts that utilize this, it’s important to note the latter part of the man page. Yes/OK returns 0; No/Cancel returns 1. For internal errors/malformed command, whiptail returns -1.

Sample output:

 * Note: The “10 30” is height, and width represented in cols and rows not pixels.
Sample command:
whiptail –yesno –title “Question for you” “This is cool, no?” 10 30

Dialog
Dialog is a more powerful counterpart than whiptail, much more verbose in it’s usage providing flexability.

Sample output:


Sample command:
dialog –title “Dialog title” –checklist “Instructions for dialog”, 15 60 2 \
optionA “Description for A goes here” valA \

optionB “Description for B goes here” valB

Make sure you read the man pages on the return codes for use in your various shell scripts, etc.

No Comments on Command line musings: whiptail and dialog
Categories: linux purdy

Remote hooks with mercurial August 6, 2009

If you use mercurial in a centralized model – it can be a little fiesty to create and troubleshoot your hooks.

You’ll want to make sure you scan over the /hgrc hooks section and the redbook section on hooks

First, a few rule of thumbs:

  1. It’s possible to write them in bash/sh, and python
  2. If bash-style, your script is executed with your user’s shell. No need to put #!/bin/bash on top really (helps in vim though)
  3. Your script must be +x for the user that’s executing it. (Remote push over http/s, your www/apache user must have +x to it)

How to troubleshoot is easy, I start like this, from /home/rovangju:

This will set the stage. Then we’ll create our hook:

Your hook is now good to go!
Now, in order to fire this off we need to emulate a centralized model, so when we push to the main, we’ll fire off our hook.

/home/rovangju/repojunk/main/.hg/hgrc:

If your file looks like that with the correct path try:

If all goes well you’ll see something like:

And that’s your starting point for your hook.
I just wanted to throw this out there for myself and others someday if they’re trying to find a better way to troubleshoot why their hook isn’t firing or working.
Also, logger is your friend!

No Comments on Remote hooks with mercurial
Categories: hg linux

Very in-depth explanation of *nix filesystem June 12, 2009

Came across this while reading about build integration for development and thought I’d make a note about it. It’s much more than just a ‘user files go in the /home/’ directory sheet – it’s everything you could imagine regarding why *nix systems are laid out like they are. Link:
http://www.pathname.com/fhs/

No Comments on Very in-depth explanation of *nix filesystem
Categories: linux servers

VirtualBox Rocks! June 9, 2009

If you’re looking for a lightweight virtualization solution – for something simple like running Ubuntu from within Windows look no further.

VirtualBox has everything a growing boy/gal needs. I asked a co-worker if he knew of anything better than MS Virtual PC, but not as heavy as VMWare and he mentioned VirtualBox to me.

I quickly downloaded it and was suprised as to how lightweight and perfect of a solution it was.

Quick notes of awesome-ness (At least through my eyes from Vista host to my Ubuntu guest OS)

Mouse handling:
Once you install the virtualization drivers – you can seamlessly move your mouse from guest to host OS without having to hit any hotkeys or anything.

Fullscreen mode:
I’m currently typing from Firefox within Vista, and on my right screen I have Ubuntu fired up in fullscreen – we’re not talking crappy emulation either – i’ve got effects jammin and it’s just like working within full boot-mode.

Networking:
Networking threw me for a quick loop through my own stupidity. You can easily configure multiple adapters of many types – NAT, Bridged, you name it.

Graphics support:
Still a little lacking but for non-gaming desktop purposes the power is there for sure. I only say this because I’ve had a little difficulty with fullscreen OpenGL -style screensavers – and that might be due to my lack of installed drivers. We’ll see. But at any rate, I’m running window effects on a 1920×1200 resolution screen without any lag or issues.

Screenshot: Simple print-screen grabs both- note fullscreen ubuntu =]

No Comments on VirtualBox Rocks!
Categories: linux tools

vnstat/vnstati for quick mrtg style bandwidth graphs June 2, 2009

Ever want the nifty bandwidth charts that MRTG produces, but without the overhead of learning and manipulating the RRD (Round Robin Database) stuff?

vnstati has a built in tool that produces some very sexy snaps of interface bandwidth.

Compile and install from source and play around with the options –

For our dev box where I work I’m running 5 and 10min crons on summary, daily and monthly views:

Output – Can you tell what time our backup is copied? =]

No Comments on vnstat/vnstati for quick mrtg style bandwidth graphs
Categories: linux servers