From owner-freebsd-questions@FreeBSD.ORG Tue Mar 19 21:33:34 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C3328837 for ; Tue, 19 Mar 2013 21:33:34 +0000 (UTC) (envelope-from kudzu@tenebras.com) Received: from mail-ob0-x22f.google.com (mail-ob0-x22f.google.com [IPv6:2607:f8b0:4003:c01::22f]) by mx1.freebsd.org (Postfix) with ESMTP id 92C0985F for ; Tue, 19 Mar 2013 21:33:34 +0000 (UTC) Received: by mail-ob0-f175.google.com with SMTP id uz6so960080obc.20 for ; Tue, 19 Mar 2013 14:33:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=VDfAxWeeDMMP99Zlule0wkWjJ6jDT6bzbNIOy/6dK5M=; b=ba/f5nGQwBxsrHqmZclhoua+0lHp2xf1o2LKp3thqnVYB+lYuPQh9MpZDwC8hAz/uo iGPAjdYwwBpxL/cJC+5oKUJJkP+yepsD3d8eTUwNhCJyUzLmYcm/2/Z7ZHGRC2nC79ki Ewzgw56bJoYqk1mC6n90T9l9HuKp0mBIPUUCmdKwCXTaZECIKFpNu8nVDydd3V4ZsBz2 KbJDM2ODORG+yHWa2L/OzXLTN4vuVEoJMFE4dHLLJqOe3VXLXd343j632XaDd/zajHMa Hf+MYjRBQ29XI+44jQUCD7VG5dKipYfBMCxaS0JghiwMrNBvQtc/TgAzludzYswYwaOh NFUg== MIME-Version: 1.0 X-Received: by 10.182.192.3 with SMTP id hc3mr2548033obc.41.1363728814083; Tue, 19 Mar 2013 14:33:34 -0700 (PDT) Received: by 10.60.20.34 with HTTP; Tue, 19 Mar 2013 14:33:33 -0700 (PDT) In-Reply-To: <5148D4DD.7010703@mykitchentable.net> References: <5148D4DD.7010703@mykitchentable.net> Date: Tue, 19 Mar 2013 14:33:33 -0700 Message-ID: Subject: Re: How To Get App To Start At Boot? From: Michael Sierchio To: Drew Tomlinson Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQktADFxjJDxybBq49Z0qpppfO4lNtCqL+bkWFjHW0DAu5jjY59YgHmG7derNFoVy9zrg//Q Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 21:33:34 -0000 On Tue, Mar 19, 2013 at 2:13 PM, Drew Tomlinson 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 "$@"