Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Nov 2017 11:26:22 -0500
From:      Ernie Luzar <luzar722@gmail.com>
To:        krad <kraduk@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:  <5A0481AE.7050504@gmail.com>
In-Reply-To: <CALfReyfuTFH25fAcG=CEL=p0XNyfQVVNi0EGxFwS-Ddv3QWY3A@mail.gmail.com>
References:  <mailman.444.1510052978.1530.freebsd-questions@freebsd.org> <20171108021900.W9710@sola.nimnet.asn.au> <CALfReyfuTFH25fAcG=CEL=p0XNyfQVVNi0EGxFwS-Ddv3QWY3A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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?5A0481AE.7050504>