免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1749 | 回复: 7
打印 上一主题 下一主题

/etc/init.d 下文件的stop脚本不能自动执行? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-01-20 11:57 |只看该作者 |倒序浏览
#!/bin/bash
#
# chkconfig: 2345 20 80
#
# description: test

case "$1" in
    start)
        touch test.start
        ;;
    stop)
        touch test.stop
        ;;
esac

以上为测试用脚本 /etc/init.d/test
chmod 755 /etc/init.d/test

系统为rhel as4

chkconfig --add test
chkconfig --level 2345 test on

手工start和stop都正常

cd /etc/init.d
./test start    正常
./test stop    正常

重新启动时, 正常执行了 start 脚本
但关闭或重启系统时, stop脚本不执行

是脚本编写错误吗?谢谢

[ 本帖最后由 pashima 于 2006-1-20 14:50 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-01-20 12:06 |只看该作者
create a link under /etc/rc1.d/  /etc/rc2.d/  /etc/rc3.d/  /etc/rc5.d/.

e.g. ln -s /etc/init.d/test /etc/rc5.d/S99test

论坛徽章:
0
3 [报告]
发表于 2006-01-20 12:30 |只看该作者
chkconfig --add test 时自动建立了连接

现在是start可以开机时加载.stop不执行

论坛徽章:
0
4 [报告]
发表于 2006-01-20 12:59 |只看该作者
ln -s /etc/init.d/test /etc/rc3.d/K99test
ln -s /etc/init.d/test /etc/rc2.d/K99test
ln -s /etc/init.d/test /etc/rc1.d/K99test
ln -s /etc/init.d/test /etc/rc0.d/K99test

论坛徽章:
0
5 [报告]
发表于 2006-01-20 13:23 |只看该作者
原帖由 chinaux 于 2006-1-20 12:59 发表
ln -s /etc/init.d/test /etc/rc3.d/K99test
ln -s /etc/init.d/test /etc/rc2.d/K99test
ln -s /etc/init.d/test /etc/rc1.d/K99test
ln -s /etc/init.d/test /etc/rc0.d/K99test

能解释下么?

论坛徽章:
0
6 [报告]
发表于 2006-01-20 14:22 |只看该作者
还是不能自动执行stop脚本

把 chkconfig 设置 :  35 99 1

chkconfig --del test
chkconfig --add test

连接为:

/etc/rc.d/rc0.d/K01yy
/etc/rc.d/rc1.d/K01yy
/etc/rc.d/rc2.d/K01yy
/etc/rc.d/rc3.d/S99yy
/etc/rc.d/rc4.d/K01yy
/etc/rc.d/rc5.d/S99yy
/etc/rc.d/rc6.d/K01yy

启动时可以自动运行start                touch test.start
关闭或重启时不能运行stop              touch test.stop

连接都正常,怎么回事啊

论坛徽章:
0
7 [报告]
发表于 2006-01-20 14:25 |只看该作者
原帖由 231053469 于 2006-1-20 13:23 发表

能解释下么?



关闭(stop)的优先级为99

论坛徽章:
0
8 [报告]
发表于 2006-01-20 16:47 |只看该作者
Hello, 5th Floor, you are really sexy . Please do pay attention to "扫黄".:wink:
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP