commit 3c9b6e370946835d6c8c69a03cab7ea9cf12a425 parent 9aa0ccf14f2a01689fc61d4f77cd389f8ae6b43a Author: Jacob R. Edwards <jacob@jacobedwards.org> Date: Sat, 20 Jan 2024 18:50:12 -0800 Add window logging script It's nice to run this in a cron(8) job periodically in case X or the system crash so you know what you were doing. I actually wrote it a year or two ago. Diffstat:
| A | local/bin/bin/winlog | | | 20 | ++++++++++++++++++++ |
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/local/bin/bin/winlog b/local/bin/bin/winlog @@ -0,0 +1,20 @@ +#!/usr/local/plan9/bin/rc -e +# log windows + +fn winlist { + lsw | cut -d' ' -f2- +} + +prefix = $home/sys/log/win + +mkdir -p $prefix +winlist | sort -u >$prefix/tmp +if (test -e $prefix/0) { + if (cmp -s $prefix/^(tmp 0)) { + rm $prefix/tmp + exit + } + for (f in `{ cd $prefix && ls -r [0-8] }) + mv $prefix/^($f `{ expr $f + 1 }) +} +mv $prefix/^(tmp 0)