fb自启动的脚本
vi /usr/local/etc/rc.d/test
内容如下:
#!/bin/sh
#
# PROVIDE: test
# REQUIRE: DAEMON
# KEYWORD: test service
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
# SET THEM IN THE /etc/rc.conf FILE
#
test_enable=${test_enable-"NO"}
test_flags=${test_flags-""}
test_pidfile=${test_pidfile-"/var/run/test.pid"}
. /etc/rc.subr
name="test"
rcvar=`set_rcvar`
load_rc_config $name
pidfile="${test_pidfile}"
test_start_cmd()
{
echo Starting $name
echo ${test_flags} ${command_args} ${test_pidfile}
echo put your startup script here
}
test_stop_cmd()
{
echo Stoping $name
echo ${test_flags} ${command_args} ${test_pidfile}
echo put your stop script here
}
start_cmd="test_start_cmd"
stop_cmd="test_stop_cmd"
run_rc_command "$1"
----------------------------
把test_enable=YES加入/etc/rc.conf
chmod u+x /usr/local/etc/rc.d/test
然后
/usr/local/etc/rc.d/test rcvar显示了YES则表示都设置好了。
/usr/local/etc/rc.d/test start
转载于:https://blog.51cto.com/xiaosa/353860