#!/usr/bin/env bash

# $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/liifSnapshotGUI 1673 2019-03-29 14:05:36Z depa $

# usage:
#  liifSnapshotGUI

# Show $INSROOT/var/log/IifSnapshot in an endless loop with pauses,
# nicely formated in an xterm. 
# This was created in response to https://svn.mpia.de/trac/gulli/ln/ticket/1460

# name of the log-file
logf=$INSROOT/var/log/IifSnapshot

# Number of lines in the output. May need adjustment if the liifsnapshot.py
# emits more or less lines... But actually the observer can just change
# the size of the window with the usual frame manager dragging at the edges.
h=48

# New version, just showing what LtcsIifServiceWorker generates
# The update speed should be sligthly faster than IIF.SVC.CFG.INTERVAL of the IIF server...
# Number of columns
c=3
h=78
# width of the output
w=129
nice xterm -ls +aw -si +s -geometry ${w}x${h} -title $(basename $0) -e "while true ; do
   tput cup 0 0 ; sort ${logf} | pr -${c} -l999 -t -T -W ${w} | expand | awk '{printf \"%-128s\n\",\$0}' ;
   sleep 10;
done" &

exit 0
