2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 17:46:38 +00:00

Merge pull request #1453 from gurevichmark/rsyslog.conf2

Remove old version xCAT settings from rsyslog.conf file
This commit is contained in:
Xiaopeng Wang 2016-07-04 09:52:53 +08:00 committed by GitHub
commit 8da8510513

View File

@ -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