From 4646631416e03a6b26a4629f052fa2ff777611e1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 1 Jul 2016 11:17:38 -0400 Subject: [PATCH] Remove old version xCAT settings from rsyslog.conf file --- xCAT/postscripts/syslog | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index d9ee73d0b..35889640b 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -36,6 +36,7 @@ isRsyslog=0 isC3=0 xCATSettingsSTART="xCAT settings START" xCATSettingsEND="xCAT settings END" +xCATSettingsOLD="xCAT settings" xCATSettingsInfo="Entries between the START and END lines will be replaced on the next xCAT install or update" #systemdEnabled=0 # pmatch determines if 1st argument string is matched by 2nd argument pattern @@ -90,6 +91,12 @@ config_Rsyslog_C3() cp -f $2 $2.XCATORIG fi + grep "$xCATSettingsOLD$" $conf_file 2>&1 1> /dev/null + if [ $? -eq 0 ]; then + #remove the older version syslog rule generated by xCAT + sed -i "/$xCATSettingsOLD/,+1 d" $2 + fi + grep "$xCATSettingsSTART" $conf_file 2>&1 1> /dev/null if [ $? -eq 0 ]; then #remove the previous syslog rule generated by xCAT @@ -164,7 +171,18 @@ config_rsyslog_V8() cp -f $conf_file $conf_file.XCATORIG fi - # check if already an entry by xCAT. If so, we need to remove it + # check if already an old entry by xCAT. If so, we need to remove it + grep "$xCATSettingsOLD$" $conf_file 2>&1 1> /dev/null + if [ $? -eq 0 ]; then + sed -i "/$xCATSettingsOLD/,+1 d" $conf_file + fi + + grep "$xCATSettingsOLD$" $remoteconf 2>&1 1> /dev/null + if [ $? -eq 0 ]; then + sed -i "/$xCATSettingsOLD/,+1 d" $remoteconf + fi + + # check if already a previous entry by xCAT. If so, we need to remove it grep "$xCATSettingsSTART" $conf_file 2>&1 1> /dev/null if [ $? -eq 0 ]; then sed -i "/$xCATSettingsSTART/,/$xCATSettingsEND/ d" $conf_file