Below is a crosspost from stackoverflow.com
http://stackoverflow.com/questions/15646797/creating-a-startup-daemon-for-a-shell-script-in-freebsd
But it wasn't seeming to get much visibility. Feel free to answer here and/or there and I'll accept.
-----
I am trying to create a file in rc.d/ that will start up a /bin/sh script that I have written. I am following some examples found here:
http://www.freebsd.org/doc/en/articles/rc-scripting/article.html#rc-flags
It seems like I am having a problem with the pid file. Does my script need to be the one that creates the pid file, or does it automatically get created? I have tried both ways.
If my script is supposed to make it, what is the proper way to make the pid file?
Thanks.
http://stackoverflow.com/questions/15646797/creating-a-startup-daemon-for-a-shell-script-in-freebsd
But it wasn't seeming to get much visibility. Feel free to answer here and/or there and I'll accept.
-----
I am trying to create a file in rc.d/ that will start up a /bin/sh script that I have written. I am following some examples found here:
http://www.freebsd.org/doc/en/articles/rc-scripting/article.html#rc-flags
Code:
#!/bin/sh -x
# PROVIDE: copyfiles
. /etc/rc.subr
name=copyfiles
rcvar=copyfiles_enable
pidfile="/var/run/${name}.pid"
command="/var/etc/copy_dat_files.sh -f /var/etc/copydatafiles.conf"
command_args="&"
load_rc_config $name
run_rc_command "$1"
It seems like I am having a problem with the pid file. Does my script need to be the one that creates the pid file, or does it automatically get created? I have tried both ways.
If my script is supposed to make it, what is the proper way to make the pid file?
Thanks.