分页: 1 / 1
[问题]如何开机自动运行一个脚本?
发表于 : 2008-04-12 16:20
由 李丑男
我用expect写了一个脚本。叫 rj 具体路径放在
/bin/rj
我想让这个脚本在开机的时候自动以root的权限运行。
最好是等到系统启动完之后再自动运行。
发表于 : 2008-04-12 17:27
由 bones7456
在 /etc/rc.loval 里面加一句就好了。

发表于 : 2008-04-12 17:29
由 BigSnake.NET
是 /etc/rc.local
放在exit之前
发表于 : 2008-04-12 17:30
由 bones7456
。。。笔误。

发表于 : 2008-04-12 18:08
由 李丑男
是这样子吗?
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
log_end_msg $?
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
/bin/rj
exit 3
;;
esac
可是这样子不行啊?
发表于 : 2008-04-14 11:42
由 yaoms
你的这个 rc.local有问题哦,是 /etc/rc.local吗?
发现你的这个是 /etc/init.d/rc.local .....
请加在 /etc/rc.local 中的 exit 之前:
代码: 全选
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/bin/rj
exit 0
发表于 : 2008-04-15 21:44
由 李丑男
thank you very much
发表于 : 2008-05-03 8:19
由 paulcross
是锐捷上网的脚本吧 呵呵 rj
其实你把它放到/usr/bin 里面
在系统 手选项 对话里面加上一个命令为 rj的项目也可以开机启动的
发表于 : 2008-05-07 19:16
由 sivaj
eixt 0表示什么意思 ?
发表于 : 2008-05-07 19:34
由 tenfar
please paste your code here,thank you!
发表于 : 2008-05-14 1:14
由 spiritfrog
yaoms 写了:你的这个 rc.local有问题哦,是 /etc/rc.local吗?
发现你的这个是 /etc/init.d/rc.local .....
请加在 /etc/rc.local 中的 exit 之前:
代码: 全选
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/bin/rj
exit 0
谢谢,也用这个解决了windows硬盘分区开机自动挂载的问题,
有关于rc的资料吗?网上找的感觉看不大懂。。。