<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do we enable a forwarder boot-start? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435329#M75958</link>
    <description>&lt;P&gt;Very interesting - yesterday we checked a server that had this &lt;CODE&gt;/etc/init.d/splunk&lt;/CODE&gt; file but the splunk process was not started 15 days ago when the server was rebooted. We ended up rebooting the server a couple of times and in these cases, Splunk did come up. Confusing ; -) &lt;/P&gt;</description>
    <pubDate>Thu, 30 Aug 2018 17:25:15 GMT</pubDate>
    <dc:creator>ddrillic</dc:creator>
    <dc:date>2018-08-30T17:25:15Z</dc:date>
    <item>
      <title>How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435325#M75954</link>
      <description>&lt;P&gt;We are running the following - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/opt/splunk/splunkforwarder/bin/splunk enable boot-start -user splnkfwd
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The generated file is -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# cat /etc/init.d/splunk
#!/bin/sh
#
# /etc/init.d/splunk
# init script for Splunk.
# generated by 'splunk enable boot-start'.
#
# chkconfig: 2345 90 60
# description: Splunk indexer service
#
RETVAL=0

. /etc/init.d/functions

splunk_start() {
  echo Starting Splunk...
  "/opt/splunk/splunkforwarder/bin/splunk" start --no-prompt --answer-yes
  RETVAL=$?
  [ $RETVAL -eq 0 ] &amp;amp;&amp;amp; touch /var/lock/subsys/splunk
}
splunk_stop() {
  echo Stopping Splunk...
  "/opt/splunk/splunkforwarder/bin/splunk" stop
  RETVAL=$?
  [ $RETVAL -eq 0 ] &amp;amp;&amp;amp; rm -f /var/lock/subsys/splunk
}
splunk_restart() {
  echo Restarting Splunk...
  "/opt/splunk/splunkforwarder/bin/splunk" restart
  RETVAL=$?
  [ $RETVAL -eq 0 ] &amp;amp;&amp;amp; touch /var/lock/subsys/splunk
}
splunk_status() {
  echo Splunk status:
  "/opt/splunk/splunkforwarder/bin/splunk" status
  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
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Where is the binding of &lt;CODE&gt;splunk&lt;/CODE&gt; to &lt;CODE&gt;splnkfwd&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;One SA suggested to run the following -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/opt/splunk/splunkforwarder/bin/splunk enable boot-start -user splnkfwd
sed -i '/RETVAL/a USER=splnkfwd' /etc/init.d/splunk
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What do we need to do?&lt;/P&gt;

&lt;P&gt;Running - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/opt/splunk/splunkforwarder/bin/splunk boot-start -user splnkfwd
Command error: The subcommand '-user' is not valid for command 'boot-start'.
Data forwarding configuration management tools.
  Commands:
      enable local-index [-parameter &amp;lt;value&amp;gt;] ...
      disable local-index [-parameter &amp;lt;value&amp;gt;] ...
      display local-index
      add forward-server server
      remove forward-server server
      list forward-server
  Objects:
      forward-server       a Splunk forwarder to forward data to be indexed
      local-index          a local search index on the Splunk server
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Matt said that it's all here -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$ cat splunk-launch.conf
#   Version 6.5.1

# Modify the following line to suit the location of your Splunk install.
# If unset, Splunk will use the parent of the directory containing the splunk
# CLI executable.
#
# SPLUNK_HOME=/home/build/build-home/ivory

# By default, Splunk stores its indexes under SPLUNK_HOME in the
# var/lib/splunk subdirectory.  This can be overridden
# here:
#
# SPLUNK_DB=/home/build/build-home/ivory/var/lib/splunk
# Splunkd daemon name
SPLUNK_SERVER_NAME=SplunkForwarder

# Splunkweb daemon name
SPLUNK_WEB_NAME=splunkweb

# If SPLUNK_OS_USER is set, then Splunk service will only start
# if the 'splunk [re]start [splunkd]' command is invoked by a user who
# is, or can effectively become via setuid(2), $SPLUNK_OS_USER.
# (This setting can be specified as username or as UID.)
#
# SPLUNK_OS_USER
SPLUNK_OS_USER=splnkfwd
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For one thing, &lt;CODE&gt;Splunk Enterprise 7.0 System Administration&lt;/CODE&gt; should probably change -&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5675i8D2F285D257F877E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 20:41:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435325#M75954</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-08-29T20:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435326#M75955</link>
      <description>&lt;P&gt;I'm surprised Splunk hasn't fixed how it creates the boot-start file.  Try this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/bin/sh
RETVAL=0
&amp;nbsp;
. /etc/init.d/functions
&amp;nbsp;
splunk_start() {
&amp;nbsp;&amp;nbsp;echo Starting Splunk...
&amp;nbsp;&amp;nbsp;su - splnkfwd -c '"/opt/splunk/bin/splunk" start --no-prompt --answer-yes'
&amp;nbsp;&amp;nbsp;RETVAL=$?
&amp;nbsp;&amp;nbsp;[ $RETVAL -eq 0 ] &amp;amp;&amp;amp; touch /var/lock/subsys/splunk
}
splunk_stop() {
&amp;nbsp;&amp;nbsp;echo Stopping Splunk...
&amp;nbsp;&amp;nbsp;su - splnkfwd  -c '"/opt/splunk/bin/splunk" stop'
&amp;nbsp;&amp;nbsp;RETVAL=$?
&amp;nbsp;&amp;nbsp;[ $RETVAL -eq 0 ] &amp;amp;&amp;amp; rm -f /var/lock/subsys/splunk
}
splunk_restart() {
&amp;nbsp;&amp;nbsp;echo Restarting Splunk...
&amp;nbsp;&amp;nbsp;su - splnkfwd -c '"/opt/splunk/bin/splunk" restart'
&amp;nbsp;&amp;nbsp;RETVAL=$?
&amp;nbsp;&amp;nbsp;[ $RETVAL -eq 0 ] &amp;amp;&amp;amp; touch /var/lock/subsys/splunk
}
splunk_status() {
&amp;nbsp;&amp;nbsp;echo Splunk status:
&amp;nbsp;&amp;nbsp;su - splnkfwd -c '"/opt/splunk/bin/splunk" status'
&amp;nbsp;&amp;nbsp;RETVAL=$?
}
case "$1" in
start)
&amp;nbsp;&amp;nbsp;&amp;nbsp;splunk_start
&amp;nbsp;&amp;nbsp;&amp;nbsp;;;
stop)
&amp;nbsp;&amp;nbsp;&amp;nbsp;splunk_stop
&amp;nbsp;&amp;nbsp;&amp;nbsp;;;
restart)
&amp;nbsp;&amp;nbsp;&amp;nbsp;splunk_restart
&amp;nbsp;&amp;nbsp;&amp;nbsp;;;
status)
    splunk_status
    ;;
esac
&amp;nbsp;
exit $RETVAL
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Aug 2018 22:26:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435326#M75955</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-08-29T22:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435327#M75956</link>
      <description>&lt;P&gt;Interesting @richgalloway - let's keep in mind that all works fine with the out-of-the-box &lt;CODE&gt;/etc/init.d/splunk&lt;/CODE&gt; file while &lt;CODE&gt;splunk-launch.conf&lt;/CODE&gt; makes the binding at &lt;CODE&gt;SPLUNK_OS_USER=splnkfwd&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 15:58:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435327#M75956</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-08-30T15:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435328#M75957</link>
      <description>&lt;P&gt;IME, the OOTB file does not always work.  I've seen Splunk start under root at boot-time.  The above file fixes that.  Not that there might not be another way.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 16:43:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435328#M75957</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-08-30T16:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435329#M75958</link>
      <description>&lt;P&gt;Very interesting - yesterday we checked a server that had this &lt;CODE&gt;/etc/init.d/splunk&lt;/CODE&gt; file but the splunk process was not started 15 days ago when the server was rebooted. We ended up rebooting the server a couple of times and in these cases, Splunk did come up. Confusing ; -) &lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 17:25:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435329#M75958</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-08-30T17:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435330#M75959</link>
      <description>&lt;P&gt;A side question, besides creating the &lt;CODE&gt;/etc/init.d/splunk&lt;/CODE&gt; file, does the &lt;CODE&gt;/opt/splunk/splunkforwarder/bin/splunk enable boot-start -user splnkfwd&lt;/CODE&gt; do anything else?&lt;/P&gt;

&lt;P&gt;Because we want to advise our SAs, to simply deploy the modified script @richgalloway provided and bypass running the command.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:47:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435330#M75959</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-09-12T18:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435331#M75960</link>
      <description>&lt;P&gt;It's interesting.&lt;/P&gt;

&lt;P&gt;-- When 'splunk enable boot-start -user &lt;U&gt;' is invoked, SPLUNK_OS_USER&lt;BR /&gt;
  is set to &lt;U&gt; as a side effect.&lt;/U&gt;&lt;/U&gt;&lt;/P&gt;

&lt;P&gt;It's at &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.0/Admin/Splunk-launchconf" target="_blank"&gt;splunk-launch.conf.spec&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And we speak about it at &lt;A href="https://answers.splunk.com/answers/692988/why-is-optsplunkforwardervar-owned-by-root-on-inst.html?childToView=693002#answer-693002" target="_blank"&gt;Why is /opt/splunkforwarder/var/ owned by root on install when nothing else is?&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:39:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435331#M75960</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2020-09-29T21:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435332#M75961</link>
      <description>&lt;P&gt;An update - we do the following these days - &lt;/P&gt;

&lt;P&gt;As root -&lt;BR /&gt;
&lt;CODE&gt;$SPLUNK_HOME/bin/splunk enable boot-start -user &amp;lt;splunk user&amp;gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In addition, we add &lt;CODE&gt;USER=&amp;lt;splunk user&amp;gt;&lt;/CODE&gt; to &lt;CODE&gt;/etc/init.d/splunk&lt;/CODE&gt; underneath the &lt;CODE&gt;RETVAL=0&lt;/CODE&gt; entry.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 19:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/435332#M75961</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2019-02-13T19:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do we enable a forwarder boot-start?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/511197#M86824</link>
      <description>&lt;P&gt;How do we do boot-start in windows system?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 18:04:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-we-enable-a-forwarder-boot-start/m-p/511197#M86824</guid>
      <dc:creator>vagaleraj</dc:creator>
      <dc:date>2020-07-27T18:04:53Z</dc:date>
    </item>
  </channel>
</rss>

