@@ -5,14 +5,20 @@ LOCAL=$(find $SPLUNK_HOME/etc/system/local -type f -name deploymentclient.conf |
5
5
RESTART_CHECK=$SPLUNK_HOME /etc/restartds.txt
6
6
7
7
# ## Check variables and take action accordingly
8
- if [ $LOCAL = " 1" ] & [ $DEPLOYED_APP = " 0" ]; then
9
- echo $( date -R) $HOSTNAME : No deploymentclient.conf detected in \$ SPLUNK_HOME/etc/apps. Bailing out so the fowarder doesn\' t get orphaned.
10
- exit
11
- elif [ $LOCAL = " 1" ] & [ $DEPLOYED_APP = " 1" ]; then
12
- # Remove the deploymentclient.conf from $SPLUNK_HOME/etc/system/local
13
- rm -f $SPLUNK_HOME /etc/system/local/deploymentclient.conf > /dev/null 2>&1
14
- echo $( date -R) $HOSTNAME : Removed deploymentclient.conf from local system.
15
- touch $RESTART_CHECK
16
- else
17
- echo $( date -R) $HOSTNAME : No deploymentclient.conf correction necessary.
18
- fi
8
+ # # If there is no deployed app with a deployment client, bail out
9
+ if [ $DEPLOYED_APP = " 0" ]; then
10
+ echo $( date -R) $HOSTNAME : No deploymentclient.conf detected in $SPLUNK_HOME /etc/apps. Bailing out so the fowarder doesn\' t get orphaned.
11
+ exit 1
12
+ # # If more than one deploymentclient.conf file is deployed, bail out
13
+ elif [ $DEPLOYED_APP > " 1" ]; then
14
+ echo $( date -R) $HOSTNAME : Multiple deploymentclient.conf detected in $SPLUNK_HOME /etc/apps. Check all deployed apps to ensure you\' re only using one.
15
+ exit 1
16
+ # # If there's 1 local config and 1 deployed config, remove the local one and set the checkpoint file
17
+ elif [ $LOCAL = " 1" ] & [ $DEPLOYED_APP = " 1" ]; then
18
+ # Remove the deploymentclient.conf from $SPLUNK_HOME/etc/system/local
19
+ rm -f $SPLUNK_HOME /etc/system/local/deploymentclient.conf > /dev/null 2>&1
20
+ echo $( date -R) $HOSTNAME : Removed deploymentclient.conf from local system.
21
+ touch $RESTART_CHECK
22
+ else
23
+ echo $( date -R) $HOSTNAME : No deploymentclient.conf correction necessary.
24
+ fi
0 commit comments