求linux下编译完程序所写启动脚本的注释????

由 print 在 02-06-2004 23:02 发表:

求linux下编译完程序所写启动脚本的注释????

18.创建启动脚本

vi /etc/rc.d/init.d/named

#!/bin/sh

named This shell script takes care of starting and stopping

named (BIND DNS server).

chkconfig: 345 55 45

description: named (BIND) is a Domain Name Server (DNS) \

that is used to resolve host names to IP addresses.

probe: true

Source function library.

. /etc/rc.d/init.d/functions

Source networking configuration.

. /etc/sysconfig/network

Check that networking is up.

[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/named ] || exit 0

[ -f /etc/named.conf ] || exit 0

See how we were called.

case "$1" in

start)

Start daemons.

echo -n "Starting named: "

daemon named

echo

touch /var/lock/subsys/named

;;

stop)

Stop daemons.

echo -n "Shutting down named: "

killproc named

rm -f /var/lock/subsys/named

echo

;;

status)

/usr/sbin/rndc status

exit $?

;;

restart)

$0 stop

$0 start

exit $?

;;

reload)

/usr/sbin/rndc reload

exit $?

;;

probe)

named knows how to reload intelligently; we don't want linuxconf

to offer to restart every time

/usr/sbin/rndc reload >/dev/null 2>&1 || echo start

exit 0

;;

*)

echo "Usage: named {start|stop|status|restart}"

exit 1

esac

exit 0

19.将/etc/rc.d/init.d/named变成可执行文件。

chmod 755 /etc/rc.d/init.d/named

20.创建启动脚本symbollink

ln -s /etc/rc.d/init.d/named /etc/rc.d/rc0.d/K45named

ln -s /etc/rc.d/init.d/named /etc/rc.d/rc1.d/K45named

ln -s /etc/rc.d/init.d/named /etc/rc.d/rc2.d/K45named

ln -s /etc/rc.d/init.d/named /etc/rc.d/rc3.d/S55named

ln -s /etc/rc.d/init.d/named /etc/rc.d/rc4.d/S55named

ln -s /etc/rc.d/init.d/named /etc/rc.d/rc5.d/S55named

ln -s /etc/rc.d/init.d/named /etc/rc.d/rc6.d/K45named

21.启动bind9

/etc/rc.d/init.d/named start

停止bind9

/etc/rc.d/init.d/named stop

查看状态

/etc/rc.d/init.d/named status

上面是一段配置dns的教程,能否麻烦各位就/etc/rc.d/init.d/named文件的内容给点注释???最好是讲讲原理

我成功安装并配置好bind9,可写启动脚本老不行,是按照上面的教程修改的...


由 print 在 02-10-2004 19:24 发表:


感谢斑主的解答,下面是我的启动脚本,可启动NAMED出现如下错误

[root@dns init.d]# /etc/rc.d/init.d/named start

Starting named: execvp: 没有那个文件或目录

[失败]

我注释掉daemon named就不会出现错误提示,可named根本没启动,

/etc/rc.d/init.d/named 文件内容

#!/bin/sh

named This shell script takes care of starting and stopping

named (BIND DNS server).

chkconfig: 345 55 45

description: named (BIND) is a Domain Name Server (DNS) \

that is used to resolve host names to IP addresses.

probe: true

Source function library.

. /etc/rc.d/init.d/functions

Source networking configuration.

. /etc/sysconfig/network

Check that networking is up.

[ ${NETWORKING} = "no" ] && exit 0

#echo -n "ssss"

[ -f /soft/bind/sbin/named ] || exit 0

#echo -n "aaa"

[ -f /soft/bind/etc/named.conf ] || exit 0

#echo -n "sssssaaa"

See how we were called.

case "$1" in

start)

Start daemons.

echo -n "Starting named: "

daemon named

echo

touch /soft/bind/temp/named

;;

stop)

Stop daemons.

echo -n "Shutting down named: "

killproc named

rm -f /soft/bind/temp/named

echo

;;

status)

/soft/bind/sbin/rndc status

exit $?

;;

restart)

$0 stop

$0 start

exit $?

;;

reload)

/soft/bind/sbin/rndc reload

exit $?

;;

probe)

named knows how to reload intelligently; we don't want linuxconf

to offer to restart every time

/soft/bind/sbin/rndc reload >/dev/null 2>&1 || echo start

exit 0

;;

*)

echo "Usage: named {start|stop|status|restart}"

exit 1

esac

exit 0


我菜故我在!

向版主反映这个帖子 | IP: 已记录

02-07-04 22:43

hotfire

版主

注册日期: Jul 2000

来自:

发帖数: 858

脚本找不到execvp

如果不想看到SUCCESS或FAILD

daemon name改成named&


╔═════════════════════════════════╗

║ 相 纵 信 知 可 千 碧 易 笑 醉 斗 青 步 背 豪 摧 ║

║ 离 隔 诺 己 鉴 古 血 水 看 卧 酒 云 行 负 气 风 ║

║ 不 万 心 青 日 留 溅 悲 四 苍 散 寄 万 三 入 少 ║

║ 相 里 中 眼 月 名 柔 击 海 山 雄 恣 里 尺 楚 年 ║

║ 忘 外 藏 对 光 事 肠 筑 扬 尽 腔 意 航 剑 狂 时 ║

╚═════════════════════════════════╝

向版主反映这个帖子 | IP: 已记录

02-08-04 15:14

print

中级会员

注册日期: Apr 2002

来自:

发帖数: 271

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus