Hello everybody, and first of all, sorry for my bad english.
I've run Linux systems for a while (Debian, Fedora...) and for the first time, I have to wrok on FreeBSD.
I've got a program cho looks like that :
On Ubuntu system, I've made a script in /etc/init.d using start-stop-daemon, and it launches on system startup.
I must do the same on FreeBsd. I've tried that :
But when I start that, it hangs, and I have to kill it with Ctrl+C. I can add a "&" after /usr/home/steph/demon/demon.sh, but in that case, I cannot stop the program using "/etc/rc.d/demon stop".
Also, is there a good way to make another user to launch the daemon (I've thought of su - steph -c "/usr/home/steph/demon/demon.sh", is there another way ?)
Thanks to everyone.
I've run Linux systems for a while (Debian, Fedora...) and for the first time, I have to wrok on FreeBSD.
I've got a program cho looks like that :
Code:
while true
do
for file in `find ./ -name \*atraiter\*
do
<some things here>
done
sleep 10
done
On Ubuntu system, I've made a script in /etc/init.d using start-stop-daemon, and it launches on system startup.
I must do the same on FreeBsd. I've tried that :
Code:
# PROVIDE: demon
. /etc/rc.subr
name="demon"
rcvar=`set_rcvar`
start_cmd="demon_start"
stop_cmd=":"
load_rc_config $name
demon_start()
{
if checkyesno ${rcvar}; then
/usr/home/steph/demon/demon.sh
fi
}
run_rc_command "$1"
But when I start that, it hangs, and I have to kill it with Ctrl+C. I can add a "&" after /usr/home/steph/demon/demon.sh, but in that case, I cannot stop the program using "/etc/rc.d/demon stop".
Also, is there a good way to make another user to launch the daemon (I've thought of su - steph -c "/usr/home/steph/demon/demon.sh", is there another way ?)
Thanks to everyone.