Date: Thu, 9 Nov 2017 18:20:15 +0000 From: krad <kraduk@gmail.com> To: Ernie Luzar <luzar722@gmail.com> Cc: Ian Smith <smithi@nimnet.asn.au>, FreeBSD Questions <freebsd-questions@freebsd.org>, Polytropon <freebsd@edvax.de>, edgar <edgar@pettijohn-web.com> Subject: Re: Need help with rc.d script Message-ID: <CALfReyeNTCTbyOGmqH2oEPxB3HNrrO9Cfc0ABLARBVZ5up4D8Q@mail.gmail.com> In-Reply-To: <5A0481AE.7050504@gmail.com> References: <mailman.444.1510052978.1530.freebsd-questions@freebsd.org> <20171108021900.W9710@sola.nimnet.asn.au> <CALfReyfuTFH25fAcG=CEL=p0XNyfQVVNi0EGxFwS-Ddv3QWY3A@mail.gmail.com> <5A0481AE.7050504@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I try to write things that work 8) On 9 November 2017 at 16:26, Ernie Luzar <luzar722@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 > > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALfReyeNTCTbyOGmqH2oEPxB3HNrrO9Cfc0ABLARBVZ5up4D8Q>