jamesoff.net




9
Jul
2008
0

grepping the output of ccze

If you ever want to grep the output of ccze and found it didn’t work right, here’s the magic incantation to do it:

tail somefile | ccze -A -o noscroll | grep ...

-A makes ccze output ASCII sequences, and -o noscroll turns off the scroll option - whatever that is exactly. The man page says it’s a good idea to turn it off if you’re redirecting the output. Omitting it seems to make the output appear in lumps :)

For example, keep an eye on squid logs omitting all MSN crap:

tail -F access.log | ccze -A -C -o noscroll | grep -v gateway.dll

Permalink | Posted in FreeBSD Sysadmin and tagged  



6
Mar
2008
0

vim as a man-page reader

Sure, why not :)

This goes in your zshrc:

  vman() {
    if [ $# -eq 0 ]; then
      /usr/bin/man
    else
      if man -w $* >/dev/null 2>/dev/null
      then
        /usr/bin/man $* | col -b | vim -c 'set ft=man nomod' -
      else
        echo No man page for $*
      fi
    fi
  }
  alias man='vman'

And this goes in your vimrc (in a suitable augroup):

  autocmd FileType man setlocal ro nonumber nolist fdm=indent fdn=2 sw=4 foldlevel=2 | nmap q :quit<CR>

Now you’ll get nicely highlighted man pages with folded sections, and you can hit q to quit just like less.

Vim as a manpage viewer


Permalink | Posted in FreeBSD Linux Sysadmin and tagged  



21
Feb
2008
4

irssi and ZNC

ZNC is an IRC bouncer with some pretty nice features. For a number of reasons I wanted to move my ircing from home to a shell, so I decided to give ZNC a try. ZNC isn’t in ports, but compiles fine using gmake.

The only problem I encountered was getting it set up to work with multiple networks in irssi. Configuring ZNC itself to put me on many networks was easy enough, and when I connected irssi to it for each network using /connect it worked fine. Using /server add to set up irssi’s server list didn’t work out so well.

Every time I tried to add another server (for connecting to another network), irssi would remove the first one. This is because irssi only considers a server’s hostname and port when trying to work out if it’s unique. When I added another server which differed from the first only by password and associated network, irssi assumed I was updating the existing one and changed it. Putting the required entries in irssi’s config by hand also didn’t work.

The solution was easy enough; one ZNC instance can listen on multiple ports, so I got it to listen on a selection of ports using multiple Listen directives in its config file, and then added each network’s server to irssi using a different port number.

Now I can take advantage of cool things like buffer replay and detaching from channels. Sorry, irssi-proxy - you don’t quite cut it now :)


Permalink | Posted in FreeBSD internets and tagged  



1
Feb
2008
0

Random tip: monitoring progress in fsck

fsck in Linux has had some kind of progress bar for a while now (at least, last time I used SuSE it did). FreeBSD’s fsck is Too Advanced for such things, and if you’re checking a big disk (like /usr) you can find yourself just sitting there with no idea of what progress it’s making.

Sit no more! Just hit Ctrl-t and fsck will reveal its secrets. (This sends the currently running process a SIGINFO.)


Permalink | Posted in FreeBSD Sysadmin and tagged  



9
Jan
2008
3

Upgrading OpenEXR

While upgrading ports on Roz’s desktop, I ran foul of this:

...
generalInterfaceTiledExamples.o(.text+0x36f): In function `writeTiled1(char const*, Imf::Array2D&, int, int, int, int)':
: undefined reference to `Imf::Channel::Channel(Imf::PixelType, int, int, bool)'
generalInterfaceTiledExamples.o(.text+0x3b3): more undefined references to `Imf::Channel::Channel(Imf::PixelType, int, int, bool)' follow
gmake[1]: *** [imfexamples] Error 1
gmake[1]: Leaving directory `/usr/work/usr/ports/graphics/OpenEXR/work/openexr-1.6.0/IlmImfExamples'
gmake: *** [all-recursive] Error 1
*** Error code 2

Remembering that in UPDATING there was something about this, I had another look:

20071008:
  AFFECTS: users of graphics/OpenEXR and graphics/ilmbase
  AUTHOR: nork@FreeBSD.org
...
  # pkg_delete -f OpenEXR
  # pkg_delete -f ilmbase       (if you already installed before CONFLICT)
  # cd /usr/ports/graphics/OpenEXR
  # make install
  # pkgdb -F

Nope, that didn’t help. pkg_delete told me ilmbase wasn’t installed. A quick Google turned up a PR about this, but it was closed with “look at UPDATING.” so that didn’t help any more.

I fixed it by rebuilding graphics/ilmbase anyway. Once that was rebuild and reinstalled, OpenEXR built fine. No idea why pkg_delete didn’t think it was installed.


Permalink | Posted in FreeBSD Sysadmin and tagged  



15
Nov
2007
3

Thunderbird’s RSS reader

Having previous tried getting Thunderbird to behave as an RSS reader on FreeBSD and failed (the option didn’t show up on the Add Account wizard), Roz asked me today about getting it going.

A quick Google search this time lead me to this post which gives the answer:

cp /usr/local/lib/thunderbird/defaults/isp/rss.rdf /usr/local/lib/thunderbird/isp/rss.rdf

and suddenly it works! :hellyeah:





29
Oct
2007
1

Detecting memory type on FreeBSD

If you need to upgrade your RAM on a Windows machine, you can just use the Crucial Memory Advisor wotsit, which scans your computer using the power of, er, power to find out what your motherboard is, what RAM you already have, and then can tell you which overpriced Crucial RAM to buy.

On FreeBSD, this doesn’t work so well. However, you can tell manually tell the Crucial site what motherboard you have and it will tell you exactly what sort of RAM is best.

This is fine if you know what motherboard you have.

if you don’t, the answer is dmidecode(8) (/usr/ports/sysutils/dmidecode). This utility grabs the same information which the Crucial thingy does, so all you need to do is find the info you need.

(more…)





28
Oct
2007
0

A productive day

What a productive day (for a Sunday):

  1. Released bMotion 0.1.0 - only about 3 years after I planned on it originally. 0.1.0 is greatly improved over the previous version, and a few weeks ago I finally decided I should stop pointless tinkering with it and get a stable releasable version :)

  2. Finished Zelda: Phantom Hourglass on the DS - mainly in celebration of releasing bMotion.

  3. Started using my Simple Monitor project at home and on my colo, and it’s working well so far. The only problem was that both machines needed Python updating to support the native sqlite class. Once that was fixed, both worked fine and are now monitoring their services. Once I get some other features I’m planning on written in, I’ll release it for other people to try.





1
May
2007
2

Firefox Addressbar Select-on-click

In Windows, clicking on the addressbar in Firefox selects the existing URL so you can type to replace or paste to replace.

In FreeBSD, clicking on the addressbar doesn’t do that. However, when you manually select the URL so you can replace it, it overwrites the contents of your clipboard and makes it so much harder to paste the URL you were about to look at.

Luckily, you can fix this :) Browse to about:config and stick urlbar in the filter box. Find the browser.urlbar.clickSelectsAll setting and change it (by double-clicking) to true.

To paste, you’ll probably have best success with Ctrl-V as middlemouse seems to paste the clipboard without overwriting the previous contents.





20
Jan
2007
3

Hard drives hate me

Last week I finally got my ~terabyte storage finished!

Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ar0s1d    677G     99G    571G    15%    /raid5

It’s less than 1024GB thanks to drive manufacturers using dodgy calculations, and also it’s RAID5, so I lose a disk’s worth of space (250GB). Seem to be doing a reasonable job of filling it up though ;)

This morning, though, I was greeted with the this email:

This email was generated by the smartd daemon running on:

host name: yomi.jamesoff.net DNS domain: jamesoff.net NIS domain:

The following warning/error was logged by the smartd daemon:

Device: /dev/ad0, Self-Test Log error count increased from 0 to 1 `

Arrgh :argh:

At least that’s the system drive rather than one of the new ones, but now I’m going to have to buy a new system drive and prepare to migrate over to it. At least thanks to having plenty of space, I have full dump(1)s of the drive so even if it does die before I replace it I can recover fairly easily.