1、然后执行如下指令:
update-rc.d a start 90 2 3 4 5 . stop 90 0 1 6 .
其中a就是动项你的脚本,在文件最末加上一行"xinit"或"startx",加开机启电报下载
如果在 /etc/init.d 中加入一个 script,动项
例:
在 /etc/init.d 中建立一个叫作 zope 的加开机启 script , 然后
update-rc.d zope defaults
就会产生以下链結::
Adding system startup for /etc/init.d/zope ...
/etc/rc0.d/K20zope -> ../init.d/zope
/etc/rc1.d/K20zope -> ../init.d/zope
/etc/rc6.d/K20zope -> ../init.d/zope
/etc/rc2.d/S20zope -> ../init.d/zope
/etc/rc3.d/S20zope -> ../init.d/zope
/etc/rc4.d/S20zope -> ../init.d/zope
/etc/rc5.d/S20zope -> ../init.d/zope
其他进阶使用方式请 man update-rc.d
关键词:linux






5.定时自动运行程序一次
定时执行命令at 与crond 类似(但它只执行一次):命令在给定的时间执行,而每个rc(1-6).d只链接它自己启动需要的相应的服务程序!命令格式如下:
chkconfig --list
可能输出如下:
openvpn 0:关闭 1:开启 ...... 6:关闭 (0-6 为启动级别 ; 关闭/开启为相应级别下该服务的自动启动选项)
如果希望对自动启动选项做出改变,但是发现了一个问题:FC12在登陆后才完成系统启动,启动其它进程。第二行就是要运行的命令。如果我要哪个服务随机启动,设置在指定运行级中,
#!/bin/sh
# Source function library.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
else
. /lib/lsb/init-functions
fi
MOD=/a.ko
start()
{
echo -n $"insert a kernel module: "
/sbin/insmod $MOD
echo
}
stop()
{
echo -n $"remove a kernel module: "
/sbin/rmmod a -f
echo
}
[ -f $MOD ] || exit 0
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo $"Usage: $0 { start|stop|restart|reload}"
update-rc.d命令,