这个开机自启动脚本如何写?
我有个脚本需要在开机自启动执行,上次我把它放置在/etc/rc.conf下面,它出错,请问,应当怎么做?本帖最后由 ulovko 于 2012-08-27 08:27 编辑
/usr/local/etc/rc.d :
The system boot process tries to execute any file with a name ending in .sh in this
directory.
/etc/rc.conf :
This file contains nothing but variables used by other /etc/rc scripts.
Various other /etc/rc.* scripts use /etc/rc.conf to get their configuration information.
/etc/rc.local:
The /etc/rc.local shell script runs at the very end of system initialization. Once every other system process has been started, /etc/rc.local runs.
This is the usual place to put startup commands for systems such as databases, small servers, and any other programs you want to run at boot time. You can place your add-on shell commands here.. 本帖最后由 luofeiyu_cu 于 2012-08-26 12:03 编辑
我的文件名是test.sh,我把它放在/usr/local/etc/rc.d/下面,没有发现开机自动运行?我已经设置了权限,可以运行。
这个脚本有点特殊,内容是:
cd/home/lala/
python test.py
请问,是否需要进行修改? 直接放下面不会被执行的,还需要在rc.conf中配置一下才可以。
想省事的话,在rc.local里写一个调用也可以。 《使用手册》中的“11.5 启动服务”中有描述,还是建议多看手册吧,这样少走不必要的弯路。
本帖最后由 ulovko 于 2012-08-27 08:31 编辑
http://bbs.chinaunix.net/thread-1793011-1-1.html> man rc.local
RC(8) FreeBSD System Manager's Manual RC(8)
NAME
rc — command scripts for auto-reboot and daemon startup
SYNOPSIS
rc
rc.conf
rc.conf.local
rc.d/
rc.firewall
rc.local
rc.shutdown
rc.subr
页:
[1]