command line


22
Dec 08

Just sitting here watching the logs go by.

Some times while working on remote servers I need to watch various log files. Typically for something like this I’ll create an extremely simple script that watches all the logs at once, since the next time I’m on that machine I’ll probably have forgotten the paths in question.

Something like this:

tail -f /var/www/apache/access.log /var/www/apache/error.log

The problem with that approach is really long lines wrap and I usually just care about the far left of the file, so I’ve been looking for a way to turn off wrapping in tail. Unfortunately that seems to be impossible. I tried messing with my shell to kill the extra characters with this:

echo -e "\e[?7l\c"

But that was messing up other things. The best solution I’ve found so far is to use less with these options

less +F -S /var/log/apache/access.log

+F puts it in a tail like mode and -S chops the line to the screen width, the only drawback is that it doesn’t intersperse the 2 files like tail does. I was hoping to pipe tails input into less in the this fashion but that didn’t seem to work right either.


27
Sep 07

Developing AIR Applications (and killing them when they misbehave)

When developing AIR applications under flexbuilder you may get a situation where the app is stuck in an unresponsive state and refuses to quit itself.

To kill it quickly on a Mac you can do the following from a terminal:

ps -A | grep adl

That will return a line that looks something like this

18132 ?? S 0:22.97 /Users/joshbloom/Applications/flexb_183522/Adobe Flex Builder 3/sdks/3.0.0/bin/adl -runtime /Users/joshbloom/Appl
18148 p1 S+ 0:00.00 grep adl

The number at the beginning of the first line first line indicates the process ID of your unresponsive AIR app.

To kill it you would run this command:

kill -9 18132

Be careful what number you put into the kill command, it will happily kill anything you tell it to. If you make a mistake you may have killed your window manager, your instant messenger or even something important like your twitter client.