From f5a6f828f4db7eedfb4222c113582fb4d7fd5a75 Mon Sep 17 00:00:00 2001 From: linggao Date: Wed, 30 Jun 2010 19:20:15 +0000 Subject: [PATCH] fix syslog so it works for snmove git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6627 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/syslog | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index 274f9cf3f..49ad33fcc 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -39,23 +39,25 @@ config_Rsyslog_C3() fi grep "xCAT settings" $conf_file 2>&1 1> /dev/null - if [ $? -gt 0 ]; then + if [ $? -eq 0 ]; then + sed -i "/# xCAT settings/,$ d" $2 + fi + echo "# xCAT settings" >> $2 - #enable to receive remote logging - if [ $isReceiving -eq 1 ]; then + #enable to receive remote logging + if [ $isReceiving -eq 1 ]; then sed -i 's/^\#\(\s\)*\$ModLoad\(\s\)*imudp.so/\$ModLoad imudp.so/' $2 sed -i 's/^\#\(\s\)*\$UDPServerRun/\$UDPServerRun/' $2 - fi + fi - #enable to send the logging to master - if [ $isLocal -eq 1 ]; then + #enable to send the logging to master + if [ $isLocal -eq 1 ]; then touch /var/log/messages - else + else sed -i 's/^\(\*\..*\)/\#\1/' $2 sed -i 's/^\(news\|local7\|mail\|authpriv\|cron\|kern\)\./\#\1\./' $2 echo "*.* @$master" >> $2 - fi - fi + fi } #echo "NTYPE=$NTYPE,OSVER=$OSVER,OSTYPE=$OSTYPE" @@ -173,11 +175,13 @@ else fi grep "xCAT settings" $conf_file 2>&1 1> /dev/null - if [ $? -gt 0 ]; then - if [ $isLinux -eq 0 ]; then # aix + if [ $? -eq 0 ]; then + sed -i "/# xCAT settings/,$ d" $conf_file + fi + + if [ $isLinux -eq 0 ]; then # aix echo "# xCAT settings" >> $conf_file echo "*.debug /var/log/messages rotate 1024K files 5" >> $conf_file - fi fi fi else @@ -187,11 +191,12 @@ else cp -f $conf_file $conf_file.XCATORIG fi grep "xCAT settings" $conf_file 2>&1 1> /dev/null - if [ $? -gt 0 ]; then - echo "# xCAT settings" >> $conf_file - echo "destination loghost { udp(\"$master\"); };" >> $conf_file - echo 'log { source(src); destination(loghost); };' >> $conf_file + if [ $? -eq 0 ]; then + sed -i "/# xCAT settings/,$ d" $conf_file fi + echo "# xCAT settings" >> $conf_file + echo "destination loghost { udp(\"$master\"); };" >> $conf_file + echo 'log { source(src); destination(loghost); };' >> $conf_file else if [ -f $conf_file.XCATORIG ]; then rm -f $conf_file