Deployment Architecture

Can we restart a splunkforwarder in linux box by calling a script in inputs.conf?

saurabh009
Path Finder

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

0 Karma

jnudell_2
Builder

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.

0 Karma

saurabh009
Path Finder

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.

0 Karma

ddrillic
Ultra Champion

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.

0 Karma

saurabh009
Path Finder

I am trying to restart second time after the app gets deployed via script.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...