#!/bin/ksh
# @(#)pt7764j/xs_solaris/CMS/api_examples/ph_log	1.3 97/07/25
#
#
# FILE:    ph_log
# CREATED: 5-Jul-97
# AUTHOR:  H. G. Barney 
# PURPOSE: test file for phonehome application and reason code patch
#          this script is called by the PhoneHome application
#          when it is started up using the ph.conf.reason.test
#          configuration file
#
# $1 - module name and number
# $2 - attribute name
# $3 - previous value of attribute
# $4 - new value of attribute
# $5 - reason for change [empty string if reason not specified]
# $6 - timestamp
# $7 - location or "-" if the module does not have a location
# $8 - reason code value

PH_VAR_DIR=/var/phonehome
LOG_FILE=/var/phonehome/log
CONDITION_LOG=/var/phonehome/conditions
STATECOND_LOG=/var/phonehome/conditions_and_states

if [ ! -d $PH_VAR_DIR ]; then
	mkdir /var/phonehome
        touch $LOG_FILE
	touch $CONDITION_LOG
	touch $STATECOND_LOG
fi

echo "$6: $1($7) $2 $3->$4 $5 ($8)" >> $LOG_FILE

if [ "$2" == "condition" ]; then
	echo "$1 $3->$4 $5 ($8)" >> $CONDITION_LOG
fi

if [ "$2" == "condition" -o "$2" == "state" ]; then
	echo "$2 $1 $3->$4 $5 ($8)" >> $STATECOND_LOG
fi


