#!/bin/sh -x

# Restart for Solaris

TARGETDIR="`dirname ${0}`/.."

logFile="${TARGETDIR}/log/restart.`date +'%Y-%m-%d_%H.%M.%S'`.log"

INIT_SCRIPT=
. ${TARGETDIR}/install.vars

echo `date` : `pwd`/restart_solaris.sh > $logFile

# no system init.d script, use engine script from bin
INIT_SCRIPT=$TARGETDIR/bin/${APP_BASENAME}Engine

echo `date` : Stopping using $INIT_SCRIPT... >> $logFile 2>&1
$INIT_SCRIPT stop >> $logFile 2>&1
echo `date` : Sleeping 10 seconds... >> $logFile 2>&1
sleep 10
echo `date` : Starting using $INIT_SCRIPT... >> $logFile 2>&1
$INIT_SCRIPT start >> $logFile 2>&1	


# Print the service process summary to the logfile
echo `date` : New Service Process below: >> $logFile
/usr/bin/ps -Af -o pid,ppid,args | grep 'app=${APP_BASENAME}Service' | grep -v grep >> $logFile 2>&1
echo `date` : Exiting restart script >> $logFile
sleep 1

exit
