We’ll close this chapter with a brief look at a nice utility that
can be useful for keeping track of how you spend your time, information
that system administrators will find comes in handy all too often. It is
called plod
and was written by
Hal Pomeranz (see http://bullwinkle.deer-run.com/~hal/plod/). While there
are similar utilities with a GUI interface (e.g., gtt
and karm
, from the Gnome and KDE window manager
packages, respectively), I prefer this simpler one that doesn’t require
a graphical environment.
plod
works by maintaining a log
file containing time stamped entries that you provide; the files’
default location is ~/.logdir/yyyymm, where yyyy and mm indicate the current year and month,
respectively. plod
log files can
optionally be encrypted.
The command has lots of options, but its simplest form is the following:
$ plod
[text]
If some text is included on the command, it is written to the log file (tagged with the current date and time). Otherwise, you enter the command’s interactive mode, in which you can type in the desired text. Input ends with a line containing a lone period.
Once you’ve accumulated some log entries, you can use the
command’s -C
, -P
, and -E
options to display them, either as continuous output, piped through a
paging command like more
(although
less
is the default), or via an
editor (vi
is the default). You can
specify a different paging program or editor with the PAGER and EDITOR environment variables
(respectively).
You can also use the -G
option
to search plod
log files; it differs
from grep
in that matching entries
are displayed in their entirety. By default, searches are not case
sensitive, but you can use -g
to make
them so.
Here is an example command that searches the current log file:
$ plod -g hp-ux
-----
05/11/2001, 22:56 --
Starting to configure the new HP-UX box.
-----
05/11/2001, 23:44 --
Finished configuring the new HP-UX box.
Given these features, plod
can
be used to record and categorize the various tasks that you perform. We
will look at a script which can read and summarize plod
data in Chapter 14.
Get Essential System Administration, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.