-
Notifications
You must be signed in to change notification settings - Fork 6
/
toucher.sh
executable file
·56 lines (43 loc) · 1.38 KB
/
toucher.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# A shell script to take my screenlogs and generate a simple
# visualization for viewing from another machine or my iPhone
# hacked up by Tomasz Malisiewicz (tomasz@cmu.edu)
# $Id: toucher.sh,v 1.5 2009/02/12 08:03:45 tmalisie Exp $
# $Date: 2009/02/12 08:03:45 $
# $Author: tmalisie $
# $Revision: 1.5 $
#Show this many last lines from each tab
SHOWLAST=20
#Wait this many seconds before re-generating output
REFRESH_TIME=20
export CLUSTY_LOGDIR=/afs/csail.mit.edu/u/t/tomasz/public_html/screenlogs/
#LOGDIR=~/public_html/screenlogs/
#Output html page
RESFILE=${CLUSTY_LOGDIR}/index.html
sleep 1
while [ 1 -gt 0 ]; do
echo "updating log at `date`"
files=`find ${CLUSTY_LOGDIR}/ -name "mylog*"`
#touch ${CLUSTY_LOGDIR}/*
echo "<html><head><title>SEG log</title></head><body>" > $RESFILE
echo "<table border=2 align=top>" >> $RESFILE
echo "<tr>" >> $RESFILE
for f in $files
do
echo "<td valign=top><b>" >> $RESFILE
echo $f >> $RESFILE
echo "</b></td>" >> $RESFILE
done
echo "</tr>" >> $RESFILE
echo "<tr>" >> $RESFILE
for f in $files
do
echo "<td valign=top><pre>" >> $RESFILE
cat $f | tail -${SHOWLAST} >> $RESFILE
echo "</pre></td>" >> $RESFILE
done
echo "</tr>" >> $RESFILE
echo "</table>" >> $RESFILE
echo "</body></html>" >> $RESFILE
sleep ${REFRESH_TIME}
done