Skip to content

Commit

Permalink
bug fix with sed command for servername replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
araman-m committed Dec 13, 2023
1 parent cc38cc5 commit 80dc2ba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/splunkconf-cloud-recovery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ exec >> /var/log/splunkconf-cloud-recovery-debug.log 2>&1
# 20231117 up to 9.1.2
# 20231120 add variable splversion and splhash to reduce typo risk when updating version
# 20231206 add tag splunkhostmode and splunkhostmodeos
# 20231213 bug fix with sed command for servername replacement

VERSION="20231206b"
VERSION="20231213a"

# dont break script on error as we rely on tests for this
set +e
Expand Down Expand Up @@ -1835,8 +1836,8 @@ if [ "$MODE" != "upgrade" ]; then
echo "specific instance name : changing hostname to ${hostinstancename} "
# first time actions
# set instance names if splunk instance was already started (in the ami or from the backup...)
sed -i -e 's/ip\-[0-9]\{1,3\}\-[0-9]\{1,3\}\-[0-9]\{1,3\}\-[0-9]\{1,3\}/${hostinstancename}/g' ${SPLUNK_HOME}/etc/system/local/inputs.conf
sed -i -e 's/ip\-[0-9]\{1,3\}\-[0-9]\{1,3\}\-[0-9]\{1,3\}\-[0-9]\{1,3\}/${hostinstancename}/g' ${SPLUNK_HOME}/etc/system/local/server.conf
sed -i -e "s/ip\-[0-9]\{1,3\}\-[0-9]\{1,3\}\-[0-9]\{1,3\}\-[0-9]\{1,3\}/${hostinstancename}/g" ${SPLUNK_HOME}/etc/system/local/inputs.conf
sed -i -e "s/ip\-[0-9]\{1,3\}\-[0-9]\{1,3\}\-[0-9]\{1,3\}\-[0-9]\{1,3\}/${hostinstancename}/g" ${SPLUNK_HOME}/etc/system/local/server.conf
if [ ! -f "${SPLUNK_HOME}/etc/system/local/inputs.conf" ]; then
# Splunk was never started (ie we just deployed in the recovery above)
echo "initializing inputs.conf with ${hostinstancename}\n"
Expand Down

0 comments on commit 80dc2ba

Please sign in to comment.