diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index 49ad33fcc..358c825c1 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -36,26 +36,33 @@ config_Rsyslog_C3() if [ ! -f $2.XCATORIG ]; then cp -f $2 $2.XCATORIG + else + cat $2 > $2.XCATORIG fi grep "xCAT settings" $conf_file 2>&1 1> /dev/null if [ $? -eq 0 ]; then - sed -i "/# xCAT settings/,$ d" $2 + sed "/# xCAT settings/,$ d" $2 >/tmp/sed.tmp + cat /tmp/sed.tmp >$2 fi echo "# xCAT settings" >> $2 #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 + sed 's/^\#\(\s\)*\$ModLoad\(\s\)*imudp.so/\$ModLoad imudp.so/' $2 >/tmp/sed.tmp + cat /tmp/sed.tmp >$2 + sed 's/^\#\(\s\)*\$UDPServerRun/\$UDPServerRun/' $2 >/tmp/sed.tmp + cat /tmp/sed.tmp >$2 fi #enable to send the logging to master if [ $isLocal -eq 1 ]; then touch /var/log/messages else - sed -i 's/^\(\*\..*\)/\#\1/' $2 - sed -i 's/^\(news\|local7\|mail\|authpriv\|cron\|kern\)\./\#\1\./' $2 + sed 's/^\(\*\..*\)/\#\1/' $2 >/tmp/sed.tmp + cat /tmp/sed.tmp >$2 + sed 's/^\(news\|local7\|mail\|authpriv\|cron\|kern\)\./\#\1\./' $2 >/tmp/sed.tmp + cat /tmp/sed.tmp >$2 echo "*.* @$master" >> $2 fi } @@ -67,7 +74,7 @@ if [[ $NTYPE = service ]]; then fi if [[ $OSTYPE = linux* ]]; then - if [[ $OSVER = fedora* ]] || [[ $OSVER = rhels5* ]] || [[ -f /etc/fedora-release ]]; then + if [[ $OSVER = fedora* ]] || [[ $OSVER = rhels5* ]] || [[ $OSVER = rhel6* ]] || [[ $OSVER = rhels6* ]] || [[ -f /etc/fedora-release ]]; then if [ -e /etc/rsyslog.conf ]; then conf_file="/etc/rsyslog.conf" sysconfig="/etc/sysconfig/rsyslog" @@ -145,7 +152,8 @@ if [ $ng -eq 1 ]; 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 + sed 's/#udp(ip("0.0.0.0/udp(ip("0.0.0.0/' $conf_file >/tmp/sed.tmp + cat /tmp/sed.tmp >$conf_file fi fi @@ -176,7 +184,8 @@ else grep "xCAT settings" $conf_file 2>&1 1> /dev/null if [ $? -eq 0 ]; then - sed -i "/# xCAT settings/,$ d" $conf_file + sed "/# xCAT settings/,$ d" $conf_file >/tmp/sed.tmp + cat /tmp/sed.tmp >$conf_file fi if [ $isLinux -eq 0 ]; then # aix @@ -192,7 +201,8 @@ else fi grep "xCAT settings" $conf_file 2>&1 1> /dev/null if [ $? -eq 0 ]; then - sed -i "/# xCAT settings/,$ d" $conf_file + sed "/# xCAT settings/,$ d" $conf_file >/tmp/sed.tmp + cat /tmp/sed.tmp >$conf_file fi echo "# xCAT settings" >> $conf_file echo "destination loghost { udp(\"$master\"); };" >> $conf_file