haqistan

aboutcontactdonatelicensearchives

ksh Indicator Light

201 words by attila written on 2022-02-15, last edit: 2022-02-19, tags: bsd, cli, hacking, ksh, linux, monitoring, shell, telmexPrevious post: House CleaningNext post: ttyplotisms


Sometimes you need an indicator light. I used to find them comforting on the computers of yore.

In the last month we've been completely screwed over and cut off by an extended Telmex outage at our house; they have not shown their faces here once since we complained, it has really sucked and continues to... but it kinda forced me to write indic, a plain old ksh script that turns your xterm or, better, tmux pane into an indicator light.

Here's a sample of the kind of thing I'm talking about. The row of colored squares near the bottom are small tmux panes, each one running indic on a different command:

Screenshot of tmux w/ttyplot and indic panes
Screenshot of tmux w/ttyplot and indic panes

By default it runs whatever command you tell it to every 10 seconds and changes the color based on the exit code. It has a few other features, but not many. Do One Thing Well is not just a good idea, after all: it's the law.

Tested and used on OpenBSD and Void Linux (using loksh), FWIW. YMMV.


Copyright © 1999-2022 by attila <attila@haqistan.net>. All Rights Reserved.