Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Mar 2013 14:33:33 -0700
From:      Michael Sierchio <kudzu@tenebras.com>
To:        Drew Tomlinson <drew@mykitchentable.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How To Get App To Start At Boot?
Message-ID:  <CAHu1Y70Uya4kLSb8XD7kW3QsJL90j0z5_UHX0tYBC1RkjUkWig@mail.gmail.com>
In-Reply-To: <5148D4DD.7010703@mykitchentable.net>
References:  <5148D4DD.7010703@mykitchentable.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 19, 2013 at 2:13 PM, Drew Tomlinson <drew@mykitchentable.net> wrote:
> I installed Splunk which is not part of the ports tree.  It's a proprietary
> app that I downloaded and installed on it's own.  I start it with
> '/usr/local/splunk/bin/splunk start'.  It should also be stopped with
> '/usr/local/splunk/bin/splunk stop'.  In an attempt to automate it, I
> created this symlink in /usr/local/etc/rc.d:

Not the way to do it at all. ;-)

(assuming /opt/splunk*/bin is in your path)

# splunk enable boot-start

This installs the script below as /etc/rc.d/splunk.  You then merely
need to put splunk_enable="YES" in /etc/rc.conf

Questions like this are better answered by searching the splunk FAQs,
etc.  Lots of good info there.


#!/bin/sh

# PROVIDE: splunkd
# REQUIRE: LOGIN
# KEYWORD: shutdown

# /etc/rc.d/splunk
# init script for Splunk.
# generated by 'splunk enable boot-start'.


. /etc/rc.subr

name=splunk
extra_commands="status"
rcvar=`set_rcvar`
eval "${rcvar}=\${${rcvar}:-'NO'}"

splunk_start()
{
        "${splunk_home:-/opt/splunkforwarder}/bin/splunk" start
--no-prompt --answer-yes "$@"
}
start_cmd=splunk_start

splunk_stop()
{
        "${splunk_home:-/opt/splunkforwarder}/bin/splunk" stop  "$@"
}
stop_cmd=splunk_stop

splunk_restart()
{
        "${splunk_home:-/opt/splunkforwarder}/bin/splunk" restart  "$@"
}
restart_cmd=splunk_restart

splunk_status()
{
        "${splunk_home:-/opt/splunkforwarder}/bin/splunk" status  "$@"
}
status_cmd=splunk_status

load_rc_config $name
run_rc_command "$@"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHu1Y70Uya4kLSb8XD7kW3QsJL90j0z5_UHX0tYBC1RkjUkWig>