Hi,
I am trying switch deployment server.
In order to do that, I am trying to push an app having deploymentclient.conf pointing to the new deployment server and inputs.conf which triggers a script.
That script removes deploymentclient.conf from "system/local" but it could't restart the splunkforwarder to take new deploymentclient.conf(app/local/deloymentclient.conf) to take effect.
Script causing the forwarder to stop and never comes back.
Below are the contents for script:-
FILE=/opt/splunkforwarder/etc/system/local/deploymentclient.conf
if test -f "$FILE"; then
echo "$FILE exist"
rm -fr "$FILE"
ls -lt "$FILE"
sleep60
/opt/splunkforwarder/bin/splunk restart
else
echo "$FILE no more exist" 1>&2
fi
exit 0
contents for inputs.conf
[script://./bin/dsconfig.sh]
interval = -1
As ddrillic said, you can use the deployment server to do this. You can create a "dummy" app, or push the app that you have the script in.
In the UI: Click on settings -> Forwarder Management
Click the Apps tab
Click Edit next to your "dummy" app or app that contains the script
In the top make sure the checkbox is checked off for Restart Splunkd and add it to a serverclass that will push the app to your target client.
This should deploy the app, and restart splunkd afterwards.
I don't want to deploy second app to restart the splunk forwarder.
App which is intended to remove the deploymentclient.conf should also do the restart of splunkforwarder second time after the app deployment restart the forwarder.
Just keep in mind that in serverclass.conf there is the restartSplunkd
capability -
restartSplunkd = true | false
* If true, restarts splunkd on the client when a member app or a directly
configured app is updated.
* Can be overridden at the serverClass level and the serverClass:app level.
* Defaults to false
It's being used also for a restart of a set of forwarders, when needed.
I am trying to restart second time after the app gets deployed via script.