Here is the test setup. In /usr/local/sbin is this script called testloop.
And here is the rc.d script
issuing the
This rc.d script is using the rc.d default daemon script method. There is another rc.d script method based on the use of the daemon command and I have that working.
I want to get this rc.d default daemon script method working.
What is missing from the rc.d script to get this working?
Code:
>cat /usr/local/sbin/testloop
#!/bin/sh
while true; do
echo -e "Success:"
sleep 10
done
Code:
>cat /usr/local/etc/rc.d/testloop
#!/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="[I]/var/run/[/I]${name}.pid"
command="[I]/usr/local/sbin/[/I]${name}"
load_rc_config ${name}
run_rc_command "$1"
service testloop start
command does start the testloop script with the "while" command in it. But it does not auto create the PID file and the service testloop stop
command complains about there being no PID file.This rc.d script is using the rc.d default daemon script method. There is another rc.d script method based on the use of the daemon command and I have that working.
I want to get this rc.d default daemon script method working.
What is missing from the rc.d script to get this working?
Last edited by a moderator: