Sha256: ef5110257c12eaa9278484a7dd005ab5b322062c8b281e40eb8b797bb1a9b930

Contents?: true

Size: 1.54 KB

Versions: 38

Compression:

Stored size: 1.54 KB

Contents

#!/bin/sh
#
# /etc/init.d/splunk
# init script for Splunk.
# generated by 'splunk enable boot-start'.
#
### BEGIN INIT INFO
# Provides: splunkd
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start splunk
# Description: Splunk indexer service
### END INIT INFO
#
RETVAL=0

splunk_start() {
  echo Starting Splunk...
  <% if @runasroot %>
  "<%= @splunkdir %>/bin/splunk" start --no-prompt --answer-yes
  <% else %>
  /bin/su - splunk -c "\"<%= @splunkdir %>/bin/splunk\" start --no-prompt --answer-yes"
  <% end %>
  RETVAL=$?
}
splunk_stop() {
  echo Stopping Splunk...
  <% if @runasroot %>
  "<%= @splunkdir %>/bin/splunk" stop 
  <% else %>
  /bin/su - splunk -c "\"<%= @splunkdir %>/bin/splunk\" stop "
  <% end %>
  RETVAL=$?
}
splunk_restart() {
  echo Restarting Splunk...
  <% if @runasroot %>
  "<%= @splunkdir %>/bin/splunk" restart  --no-prompt --answer-yes
  <% else %>
  /bin/su - splunk -c "\"<%= @splunkdir %>/bin/splunk\" restart --no-prompt --answer-yes"
  <% end %>
  RETVAL=$?
}
splunk_status() {
  echo Splunk status:
  <% if @runasroot %>
  "<%= @splunkdir %>/bin/splunk" status  --no-prompt --answer-yes
  <% else %>
  /bin/su - splunk -c "\"<%= @splunkdir %>/bin/splunk\" status --no-prompt --answer-yes"
  <% end %>
  RETVAL=$?
}
case "$1" in
  start)
    splunk_start
    ;;
  stop)
    splunk_stop
    ;;
  restart)
    splunk_restart
    ;;
  status)
    splunk_status
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|status}"
    exit 1
    ;;
esac

exit $RETVAL

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
cloud-mu-2.0.4 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.1.0beta cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.3 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.2 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.1 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.beta3 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.beta2 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.beta1 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha9 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha8 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha7 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha6 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha5 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha4 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha3 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha2 cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-2.0.0.pre.alpha cookbooks/mu-splunk/templates/default/splunk-init.erb
cloud-mu-1.9.0.pre.beta cookbooks/mu-splunk/templates/default/splunk-init.erb