#!/bin/sh
#++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Script to start the PCR_Server on the requested machine
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Written  10jul07  DLM  Started with Phil Hinz's runao script
#
#++++++++++++++++++++++++++++++++++++++++++++++++++++
#
# Check that the log directory exits.  If not, create it
#
if [ ! -e $MMTAO_DATA_DIR ]; then
    mkdir -p $MMTAO_DATA_DIR
fi
#
# Set the log file name
#
logfile="${MMTAO_DATA_DIR}/log_PCR"
#
# Start process to echo the log file to the terminal so the user can see
#   what the pcr_server is doing and and errors
#
touch $logfile
tail_logfile $logfile &
sleep 1
#
# Set the xterm title to something more informative
#
echo -n "]2;PCR @ `/bin/hostname`"
#
# Start the pcr (wfsc) process
#
xterm -geometry 70x10+0+457 -hold -sb -sl 500 -title "PCR WFSC Port" -e "local_wfsc" &
#
# Start the pcr (error) process
#
xterm -geometry 70x10+0+624 -hold -sb -sl 500 -title "PCR Error Port" -e "local_error" &
#
# Start the pcr (cmd) process and place time stamp in the logfile
#
echo "Started PCR: `date`" >> $logfile
cd ${PCR_HOME}/data_server/Source
./cmd >> $logfile
