#!/bin/sh
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# bos720 src/bos/usr/bin/cdat/types/psrasinit/config.sh 1.3 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2010 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 

#
# Script that runs on the client.
#

[ $# -ne 3 ] && exit 1
caserver=$1
mgmtport=$2
cmdport=$3

#
# Establish binding with the CA server.
#
/usr/bin/psbind register -t CentralizedLogService -i $caserver \
    -p $mgmtport -P $cmdport -x INTERNET -c CentralizedLogService
[ $? -ne 0 ] && exit 1

#
# Configure syslog.
#

# File /etc/syslog.conf is a "privfiles" and must be edited with pvi
TERM=vt100 /usr/bin/pvi -c '
" delete all lines containing centralizedlog
g/centralizedlog/d
" move to end of file
$
" append those two lines
s/$/
kern.warn	centralizedlog	CentralizedRAS\/Syslog
user.info	centralizedlog	CentralizedRAS\/Syslog/
" write file and exit from the pvi editor
wq!' /etc/syslog.conf < /dev/null > /dev/null

# Start the syslog daemon
if [ -f /etc/syslog.pid ]; then
    /usr/bin/refresh -s syslogd
else
    /usr/bin/startsrc -s syslogd
fi

#
# Configure errlog.
#
/usr/bin/odmchange -o SWservAt -q"attribute=errlg_pscale_enabled" << EOF
SWservAt:
	value=yes
EOF

# This is the default value, but force it anyway
/usr/bin/odmchange -o SWservAt -q"attribute=errlg_pscale_logstream" << EOF
SWservAt:
	value=CentralizedRAS/Errlog
EOF

# Start the errlog daemon
/usr/bin/ps wax | grep -v grep | grep -wq errdemon
[ $? -eq 0 ] && /usr/lib/errstop
/usr/lib/errdemon

exit 0
