debian启动脚本编号问题

hawk198 2011-05-21 10:22:34
在/etc/rc2.d里面做的链接

使用S100xxx的时候,发现被调用了2次,这是为什么呢?
使用S99以下的都没问题

测试代码如下
###             测试S100及以上是否被调用2次的代码
cat << "EOF" | tee /etc/init.d/testctrl
#!/bin/sh
#@(#)recover.script 8.7 (Berkeley) 8/16/94
#Script to test S100 called twice
case "$1" in
start)
echo `date`" starting"
;;
stop)
echo `date`" stopping"
;;
esac
exit 0
EOF
chmod 755 /etc/init.d/testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S100testctrl


请帮忙找到sysv关于这个启动数字的相关解释
...全文
207 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
hawk198 2011-05-23
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 steptodream 的回复:]

关闭脚本始终没有打印出来,屏幕上根本没有出现任何关闭的信息
---------------------------------
关闭的情况你要在0和6级别下作Kxxtestctrl的链接。

与其就这样往下测试找原因 你用update-rc.d命令添加开机启动 然后对比一下啊
[/Quote]
对,忘了……
我马上试试
hawk198 2011-05-23
  • 打赏
  • 举报
回复
###             测试S100及以上是否被调用2次的代码
cat << "EOF" | tee /etc/init.d/testctrl
#!/bin/sh
#Script to test S100 and above called twice
case "$1" in
start)
echo `date +%Y-%m-%d_%H:%M:%S.%N` "$0 starting"
;;
stop)
echo `date +%Y-%m-%d_%H:%M:%S.%N` "$0 stopping"
sleep 0.01
;;
esac
exit 0
EOF
chmod 755 /etc/init.d/testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S100testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S101testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S102testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S117testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S128testctrl
ln -s /etc/init.d/testctrl /etc/rc6.d/K100oraclectrl
ln -s /etc/init.d/testctrl /etc/rc6.d/K101oraclectrl
ln -s /etc/init.d/testctrl /etc/rc6.d/K102oraclectrl
ln -s /etc/init.d/testctrl /etc/rc6.d/K117oraclectrl
ln -s /etc/init.d/testctrl /etc/rc6.d/K118oraclectrl
经过试验,S100以上的数字都会被调用2次的
调用过程是S100、S101、S102, S100、S101、S102


用host+p的方式暂停,可以看到启动顺序是
/etc/rc2.d/S100testctrl
/etc/rc2.d/S101testctrl
/etc/rc2.d/S102testctrl
/etc/rc2.d/S100testctrl
/etc/rc2.d/S101testctrl
/etc/rc2.d/S102testctrl
starting enhanced syslogd:rsyslogd
/etc/rc2.d/S117testctrl
/etc/rc2.d/S128testctrl
/etc/rc2.d/S128testctrl
starting ACPI services


关闭的时候也是最开始
/etc/rc6.d/S100testctrl
/etc/rc6.d/S101testctrl
/etc/rc6.d/S102testctrl
/etc/rc6.d/S117testctrl
/etc/rc6.d/S118testctrl
/etc/rc6.d/S117testctrl
/etc/rc6.d/S118testctrl
stoping …… anacon
steptodream 2011-05-22
  • 打赏
  • 举报
回复
我用的debian6 按你的步骤测试的结果恰恰相反
脚本根本就没有被执行
steptodream 2011-05-22
  • 打赏
  • 举报
回复
关闭脚本始终没有打印出来,屏幕上根本没有出现任何关闭的信息
---------------------------------
关闭的情况你要在0和6级别下作Kxxtestctrl的链接。

与其就这样往下测试找原因 你用update-rc.d命令添加开机启动 然后对比一下啊
hawk198 2011-05-22
  • 打赏
  • 举报
回复
哦,我用的是debian 5.03的
现在启动顺序测试如下
S100
S101
S102
S100
S101
S102
第一个启动脚本
S117
S118
S117
S118
其它启动脚本

可是无论怎么测试,关闭脚本始终没有打印出来,屏幕上根本没有出现任何关闭的信息
cat << "EOF" | tee /etc/init.d/testctrl
#!/bin/sh
#Script to test S100 and above called twice
case "$1" in
start)
echo `date +%Y-%m-%d_%H:%M:%S.%N` "$0 starting"
;;
stop)
echo `date +%Y-%m-%d_%H:%M:%S.%N` "$0 stopping"
sleep 0.01
;;
esac
exit 0
EOF
chmod 755 /etc/init.d/testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S100testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S101testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S102testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S117testctrl
ln -s /etc/init.d/testctrl /etc/rc2.d/S128testctrl
steptodream 2011-05-21
  • 打赏
  • 举报
回复
说实话 我还真没见过使用100以上的数字的

比如在debian里update-rc.d这个命令 如果启动顺序是80 那么默认关闭顺序会以100-80的顺序 如果按这个规则 如果使用这个命令把启动顺序变成120 那关闭顺序是不是会变成-20 还是变成别的啥样 还真没测试过
hawk198 2011-05-21
  • 打赏
  • 举报
回复
现在搞不清楚的是关闭的时候没看到调用过程,这是什么情况啊,有人知道吗
hawk198 2011-05-21
  • 打赏
  • 举报
回复
我现在也是在试验系统,不能重启,明天再搞
另外:被执行2次确认是连续的
启动状态调用过程是
S100
S101
S102
S100
S101
S102
steptodream 2011-05-21
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 hawk198 的回复:]

我仅仅试了100以上是能工作的,但是为什么超过99还行,就没搞清除了
1楼的说是不是关闭顺序会变,倒是有这个可能的,这个我再做做实验,很快就可以把实验结果贴上来了,现在机器不能重启,暂时还不能试
[/Quote]
我只是记得update-rc.d的man内容里似乎那么说过 你是手动创建的链接 应该没关系的
另外 被执行了2次 是连续的吗
现在看电视剧正起劲 不想重启系统 我也用debian 等明天启动系统我进入debian 把你的这个现象也去测试一下。
hawk198 2011-05-21
  • 打赏
  • 举报
回复
我仅仅试了100以上是能工作的,但是为什么超过99还行,就没搞清除了
1楼的说是不是关闭顺序会变,倒是有这个可能的,这个我再做做实验,很快就可以把实验结果贴上来了,现在机器不能重启,暂时还不能试

2,163

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 UNIX文化
社区管理员
  • UNIX文化社区
  • 文天大人
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧