File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ INPUTS_FILE="$SPLUNK_HOME/etc/system/local/inputs.conf"
4
4
SERVER_FILE=" $SPLUNK_HOME /etc/system/local/server.conf"
5
5
RESTART_INPUT_CHECK=" $SPLUNK_HOME /etc/restartinput.txt"
6
6
RESTART_SERVER_CHECK=" $SPLUNK_HOME /etc/restartserver.txt"
7
- CURRENT_SERVER=$( cat " $SERVER_FILE " | grep " serverName =" | awk ' {printf $3}' )
8
7
9
8
# ## Check for the existence of the inputs file and create if it doesn't exist
10
9
if [ -f " $INPUTS_FILE " ]; then
17
16
CURRENT_HOST=$( cat " $INPUTS_FILE " | grep " host =" | awk ' {printf $3}' )
18
17
fi
19
18
20
- # ## Compare those values and correct if necessary
19
+ # ## Check for the existence of a serverName value and insert one if one isn't configured
20
+ CURRENT_SERVER=$( cat " $SERVER_FILE " | grep " serverName =" | awk ' {printf $3}' )
21
+ if [ -z " CURRENT_SERVER" ]; then
22
+ echo " $( date +" %Y-%m-%d %H:%M:%S.%3N" ) ${HOSTNAME} : There is no serverName value configured. Inserting one..."
23
+ echo "
24
+ [general]
25
+ host = IntentionallyWrong" >> " $SERVER_FILE "
26
+ CURRENT_SERVER=$( cat " $SERVER_FILE " | grep " serverName =" | awk ' {printf $3}' )
27
+ fi
28
+
29
+ # ## Check the current values of the configured files and correct if necessary
21
30
if [ " $CURRENT_HOST " = " $HOSTNAME " ]; then
22
31
echo " $( date +" %Y-%m-%d %H:%M:%S.%3N" ) ${HOSTNAME} : Currently configured host name: $CURRENT_HOST . No correction necessary..."
23
32
else
You can’t perform that action at this time.
0 commit comments