#!/bin/bash
#
# v1.0 - 24-07-2013  - Original hack
#
#############################################################################
#############################################################################
# Make sure we are user repeater!!!
   if [ "`/usr/bin/whoami`" != "repeater" ] ; then
     echo "This program must be run as user REPEATER!"
     exit 1
   fi
# Make sure we have sourced the environment file
   if [ "$RUN_ENV" != "TRUE" ] ; then
      . /home/irlp/custom/environment
   fi
#############################################################################
#
function writelog() {
  MESSAGE="`date '+%b %d %Y %T'` ${0##*/}: "$@
  if [ -n "$LOGFILE" ]; then
    echo $MESSAGE >> $LOGFILE
  fi
}

#############################################################################
#############################################################################
#
# Unlog (?) the last writelog...
#
#
LogLines=`wc -l $LOGFILE | awk '{print($1)}'`
LogLines=`expr $LogLines - 1`
head -n$LogLines $LOGFILE > $LOGFILE.rehash
rm -f $LOGFILE
mv $LOGFILE.rehash $LOGFILE
writelog "System control command received..."    # So There!! pfthththth!
