Need help with rc.d script
krad
kraduk at gmail.com
Thu Nov 9 18:20:17 UTC 2017
I try to write things that work 8)
On 9 November 2017 at 16:26, Ernie Luzar <luzar722 at gmail.com> wrote:
> krad wrote:
>
>> true, but it will probably handle it better, unless you reinvent the
>> wheel, and it is part of the base OS
>>
>>
> Here Krad is talking about using the daemon command. I had tried this
> before without any joy.
>
> So I gave it another try based on the script he provided.
> It worked, much joy.
> This is the working testloop scripts,
>
>
> >cat /usr/local/etc/rc.d/testloop.daemon
> #!/bin/sh
> #
> #
> # PROVIDE: testloop
> # REQUIRE: LOGIN DAEMON NETWORKING
> # KEYWORD: nojail shutdown
> #
> # Add the following line to /etc/rc.conf to enable testloop:
> #
> # testloop_enable="YES"
> #
>
> . /etc/rc.subr
>
> name="testloop"
> rcvar=testloop_enable
> pidfile="/var/run/${name}.pid"
> command="/usr/sbin/daemon"
> load_rc_config ${name}
> command_args="-P ${pidfile} /usr/local/sbin/${name}"
> run_rc_command "$1"
>
>
>
> >cat /usr/local/sbin/testloop
> #!/bin/sh
> while true; do
> echo -e "Success:"
> logger -t testloop -p daemon.err "Success: log"
> sleep 10
> done
> exit 0
>
>
>
More information about the freebsd-questions
mailing list