How To Get App To Start At Boot?
Michael Sierchio
kudzu at tenebras.com
Tue Mar 19 21:33:34 UTC 2013
On Tue, Mar 19, 2013 at 2:13 PM, Drew Tomlinson <drew at 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 "$@"
More information about the freebsd-questions
mailing list