#!/bin/sh # soc - Stream Of Consciousness mini-logger # Version 2 # Copyright 2014 David Meyer +JMJ socdir=/home/papa/public_html/soc socfile=$socdir/soc.log idxfile=/home/papa/public_html/index.html headfile=$socdir/head.html footfile=$socdir/foot.html tmpfile=$socdir/.tmp.txt CAT=/bin/cat DATE=/bin/date ECHO=/bin/echo #FORTUNE=/usr/games/fortune #FORTUNE='curl -s http://fortunefortoday.com/getfortuneonly.php' FORTUNE='curl -s http://www.polarhome.com:743/~papa/cgi-bin/fortune.cgi' SORT=/usr/bin/sort UTUL=/home/papa/bin/utul if [ "$1" != "-g" ]; then date=`$DATE +%F` time=`$DATE +%R` $ECHO -e "$date\t$time\t$*" >>$socfile fi $CAT $headfile >$idxfile $SORT -r $socfile >$tmpfile prevdate=0000-00-00 while read date time soc; do if [ "$date" != "$prevdate" ]; then if [ "$prevdate" != "0000-00-00" ]; then $ECHO "" >>$idxfile fi $ECHO "$date" >>$idxfile prevdate=$date fi $ECHO "[$time] $soc
" |$UTUL >>$idxfile done <$tmpfile $ECHO "
" >>$idxfile $ECHO "
" >>$idxfile
$FORTUNE >>$idxfile
$ECHO "
" >>$idxfile $CAT $footfile >>$idxfile