Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Aug 2013 17:25:35 +0200
From:      joris dedieu <joris.dedieu@gmail.com>
To:        Aryeh Friedman <aryeh.friedman@gmail.com>
Cc:        FreeBSD Mailing List <freebsd-hackers@freebsd.org>
Subject:   Re: how to make a etc/rc.d start at boot time
Message-ID:  <CAPd55qAokPchggP9-pRYSBH=h8_G0rpBKmzuJ8xSrzjpp%2BysAA@mail.gmail.com>
In-Reply-To: <CAGBxaX=Qmy_vbYjBjJXZPRaviqcYjqySBhSurdmjGC479kc4Eg@mail.gmail.com>
References:  <CAGBxaXkr2oq1OPQi338pHFOyETy1Z7RkV7mPc91dOaGmrXXjAw@mail.gmail.com> <E889514C-93E9-476C-A05F-FE5D53117279@FreeBSD.org> <CAGBxaXkR827hgV_mbspK5v7LzRTziz=oSAyeWiBGyuyvrH0gZg@mail.gmail.com> <CAGBxaX=Qmy_vbYjBjJXZPRaviqcYjqySBhSurdmjGC479kc4Eg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2013/8/11 Aryeh Friedman <aryeh.friedman@gmail.com>:
> ---------- Forwarded message ----------
> From: Aryeh Friedman <aryeh.friedman@gmail.com>
> Date: Sun, Aug 11, 2013 at 2:07 AM
> Subject: Re: how to make a etc/rc.d start at boot time
> To: Rui Paulo <rpaulo@freebsd.org>
>
>
> #!/bin/sh
> #
> # Start/stop XXX at boot time
> #
> # Copyright (C) 2013 XXX
>
> . /etc/rc.subr
>
> name="XXX"

rcvar=XXX_enable
pidfile="/var/run/rXXX.pid"

> start_cmd="${name}_start"
> stop_cmd=":"
>
> XXX_start() {
>         echo "$name started."
>         /usr/local/openjdk6/bin/java -cp \
>            /usr/local/share/XXX/XXX.jar \
>            XXX.yyy \
>            /usr/local/etc/XXX/YYY&
> }

You don't need to overwrite start_cmd

java_command="%%LOCALBASE%%/bin/java"
XXX_classpath="/usr/local/share/XXX/XXX.jar"
XXX_start_cmd="${java_command} -cp ${XXX_classpath} ..."
command="/usr/sbin/daemon"
flags="-p ${pidfile} ${XXX_start_cmd}"


>
> load_rc_config $name

This have to come earlier in the script
See : http://www.freebsd.org/doc/en/books/porters-handbook/rc-scripts.html

Joris
>
> run_rc_command "$1"
>
>
> On Sun, Aug 11, 2013 at 1:37 AM, Rui Paulo <rpaulo@freebsd.org> wrote:
>> On 10 Aug 2013, at 22:31, Aryeh Friedman <aryeh.friedman@gmail.com> wrote:
>>
>>> I am creating a port for something that needs to start a daemon at
>>> boot time I have it so I can call onestart on it but XXX_enable="YES"
>>> in /etc/rc.conf fails to load it.... i.e.
>>>
>>>
>>> /usr/local/etc/rc.d/XXX onestart -- works
>>> XXX_enable="YES" -- fails
>>
>> Please post your script.
>>
>> --
>> Rui Paulo
>>
>>
>>
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPd55qAokPchggP9-pRYSBH=h8_G0rpBKmzuJ8xSrzjpp%2BysAA>