Getting Data In

restarting splunk from script input

Cstone1
Engager

trying to restart splunk via a script... everything in the script works fine but when the restart happens the script dies at that point too. how to have splunk start the script on startup and when it does the restart, keep the script running and let it complete on its own (windows and linux)?

Labels (2)
0 Karma

nwuest
Path Finder

Hi @Cstone1,

So if I'm reading this right, you are "restarting" splunk after you upgrade it?

If so, that is where the script is breaking. After you upgrade a Splunk Instance, you need to accept the End User License Agreement again before it will even start.
Splunk cannot "restart" an instance that hasn't made it past the End User License Agreement step.

You can accept the license but instead of "splunk restart" you should use the following command depending on your splunk instance:

Splunk Enterprise:
"/opt/splunk/bin/splunk start --accept-license"
- OR-
Splunk Universal Forwarder:
"/opt/splunkforwarder/bin/splunk start --accept-license"

Let us know if this fixes your script!

V/R,
nwuest

0 Karma

Cstone1
Engager

hi thx for the reply but, no not quite.

In windows the MSI will install while splunk is running and restart it after its done. But in linux its a TGZ extract (not locking it to a specific distro using rpms or debs etc). 

Extracting it while running causes a lot of errors and sometimes succeeds but not reliable.

 

So a very highlevel sequence is this

 

1. do all checks

2. stop splunk

3. create backup

script dies when splunk stops so a partial backup is made. 

4. untar new

5. restart with accept lic and answer yes

ill add, that when i run it manually it works fine.

0 Karma

nwuest
Path Finder

Hi @Cstone1,

Are you wanting to have a splunk "instance", kick-off a script (via an app) that does a restart (of the splunk service I'm guessing) that of which keeps the script running after the restart portion?

Might I ask as to what you are trying to accomplish before and after you are wanting the splunk service to restart?

I look forward to hearing from you

V/R,
nwuest

 

0 Karma

Cstone1
Engager

cuz I'd like to shut it down, back it up, upgrade it and restart it.

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!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...