The venerable old-skool Splunk forums are now closed. Feel free to search for old content here, but new posts are no longer supported.

Instead, please visit the thriving community at answers.splunk.com to ask and answer questions about your Splunk deployment and how to get the most out of it.

Forums: SplunkRequest: SysV init script

Previous Topic: Saved Search minor nitpicks  |   Next Topic: Splunk Omni Graffle Stencils


Posts 1–5 of 5

The /opt/splunk/bin/splunk script is already very well suited to be dropped into /etc/init.d on most linux distributions so that splunk can be started and stopped automatically.

I'm requesting that reasonable comments be placed at the top of the file so that Red Hat's chkconfig (and possibly other similar programs) can be used to automatically configure splunk in the appropriate runlevels at the appropriate time. Here's my suggestion for this:

#!/bin/sh
#

  1. Splunk -- It's tasty.

#

  1. description: Splunk Log Indexer
  2. probe: false
  3. chkconfig: 345 85 1

You'll also need to touch /var/subsys/splunk during 'start', and rm -f /var/subsys/splunk during 'stop', to prevent splunk from trying to start or stop when switching between runlevels.

Finally, an installer option that asks "would you like splunk to start on boot"? Would be nice. This would simply copy the splunk startup script to /etc/init.d then run 'chkconfig --add splunk' and 'chkconfig splunk on'.

Realistically, the last bit would only need to be done on "officially" supported OSes, like RHEL and SLES, and others if you "officially" support them.

i strongly agree with this one ;)

Hey Paul,

I've written a new splunk init script that is Linux distro agnostic, just like splunk :-)

You can grab it from my website here:
http://mysfitt.net/projects/splunkcode/splunk-init

After reading this post, I added support for chkconfig as it doesn't affect cross-distro compatibility, but I'm not familiar with the "/var/subsys" thing that you're talking about. Is that specific to redhat? If you'd like to download and write a cross-distro sane patch to support that, I'd be glad to include it in the code.

Thanks!
Joe

Here is another stab at and LSB init script (redhat status etc.)

http://pastie.org/1592155

What's wrong with the one Splunk has built in now?

"splunk enable boot-start"