From 18d27b75cbd96926391dd83b60adff66aa099f45 Mon Sep 17 00:00:00 2001 From: linggao Date: Wed, 25 Mar 2009 20:26:16 +0000 Subject: [PATCH] fix syslog postscript to work on SLES 10.2 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2993 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/syslog | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index 158cb1dd9..34e56bf2f 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -77,7 +77,7 @@ if [[ $OSTYPE = linux* ]]; then #find out which syslog is used for SLES, syslog or syslog-ng result=`grep "^SYSLOG_DAEMON=" $sysconfig 2>&1` if [[ $result = *syslog-ng* ]]; then - conf_file="/etc/syslog-ng/syslog-ng.conf.in" + conf_file="/etc/syslog-ng/syslog-ng.conf" ng=1 fi fi @@ -110,7 +110,7 @@ if [ $isLinux -eq 1 ] && [ -a $sysconfig ]; then if [ $isC3 -eq 0 ]; then if [ -f /etc/xCATMN ]; then #on MN: make the syslogd be able to receive remote logs - awk '{if($0 ~ /^SYSLOGD_OPTIONS=/) { + awk '{if($0 ~ /^SYSLOGD_OPTIONS=|^SYSLOGD_PARAMS=/) { if ($0 !~ /-r/) {sub(/\"$/, " -r\"", $0)} if (($0 !~ /-m0/) && ($0 !~/-m 0/)) { sub(/\"$/, " -m 0\"", $0)} print $0} @@ -118,7 +118,7 @@ if [ $isLinux -eq 1 ] && [ -a $sysconfig ]; then else if [ $isSN -eq 1 ]; then #on SN: make the syslog be able to receive and forward remote logs - awk '{if($0 ~ /^SYSLOGD_OPTIONS=/) { + awk '{if($0 ~ /^SYSLOGD_OPTIONS=|^SYSLOGD_PARAMS=/) { if ($0 !~ /-r/) {sub(/\"$/, " -r\"", $0)} if ($0 !~ /-h/) {sub(/\"$/, " -h\"", $0)} if (($0 !~ /-m0/) && ($0 !~/-m 0/)) { sub(/\"$/, " -m 0\"", $0)} @@ -126,7 +126,7 @@ if [ $isLinux -eq 1 ] && [ -a $sysconfig ]; then else { print $0}}' $sysconfig > $sysconfig.tmp else ##turn off the time marker on all - awk '{if($0 ~ /^SYSLOGD_OPTIONS=/) { + awk '{if($0 ~ /^SYSLOGD_OPTIONS=|^SYSLOGD_PARAMS=/) { if (($0 !~ /-m0/) && ($0 !~/-m 0/)) { sub(/\"$/, " -m 0\"", $0)} print $0} else {print $0}}' $sysconfig > $sysconfig.tmp @@ -138,11 +138,13 @@ fi #syslog-ng has different way of enabling log forwarding -if [ $ng -eq 1 -a $isSN -eq 1 ]; then - if [ ! -f $conf_file.XCATORIG ]; then - cp -f $conf_file $conf_file.XCATORIG +if [ $ng -eq 1 ]; then + if [ $isSN -eq 1 -o -f /etc/xCATMN ]; then + if [ ! -f $conf_file.XCATORIG ]; then + cp -f $conf_file $conf_file.XCATORIG + fi + sed -i 's/#udp(ip("0.0.0.0/udp(ip("0.0.0.0/' $conf_file fi - sed -i 's/#udp(ip("0.0.0.0/udp(ip("0.0.0.0/' $conf_file fi