#!/bin/ksh
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#egan@us.ibm.com
#(C)IBM Corp
#

HARD_SYSLOG=$1

if [ -n "$HARD_SYSLOG" ]
then
	MASTER=$HARD_SYSLOG
fi

mv -f /etc/syslog.conf /etc/syslog.conf.ORIG
echo "*.*	@$(getent hosts $MASTER | awk '{print $1}')" >/etc/syslog.conf

case $OSVER in
	sles[89]|suse8*|suse9*|suse10|ul*)
		if grep 'SYSLOGD_PARAMS="-m0' /etc/sysconfig/syslog >/dev/null 2>&1
		then
			:
		else
			perl -pi -e 's/SYSLOGD_PARAMS="/SYSLOGD_PARAMS="-m0 /' /etc/sysconfig/syslog
		fi
		/etc/init.d/syslog restart
		;;
	rh*)
		/etc/rc.d/init.d/syslog start
		;;
	sles10)
		echo 'destination loghost { udp("10.64.0.1" port(514)); };' >> /etc/syslog-ng/syslog-ng.conf
		echo 'log { source(src); destination(loghost); };' >> /etc/syslog-ng/syslog-ng.conf
		/etc/init.d/syslog restart
		;;
esac

logger -t xcat "Install: syslog setup"

exit 0

