Need help with rc.d script

Ernie Luzar luzar722 at gmail.com
Thu Nov 9 16:26:22 UTC 2017


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