花门楼前见秋草,岂能贫贱相看老。这篇文章主要讲述CentOS7源码安装最新版本bind9-开机启动服务设置相关的知识,希望能为你提供帮助。
1、编写一个shell脚本,脚本名称named,内容如下:
#!/bin/bash
#chkconfig: 545 35 75
#description: named DNS service manager
data="https://www.songbingjia.com/usr/local/bind9/sbin/named -u named -c /usr/local/bind9/etc/named.conf"
function START()
eval $data & & echo -e "BIND9 start\\033[32m ok\\033[0m"
function STOP()
kill `cat /usr/local/bind9/var/run/named.pid` & & echo -e "BIND9 stop\\033[32m ok\\033[0m"
case "$1" in
start)
START
; ;
stop)
STOP
; ;
restart)
STOP
sleep 3
START
; ;
*)
echo "Usage: named (start|stop|restart)"
; ;
esac
————————————————
版权声明:本文为CSDN博主「张舵主」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u011288801/article/details/106737855
2、相关操作
[root@DNS-XUEXI-xuexiji init.d]# pwd
/etc/rc.d/init.d
[root@DNS-XUEXI-xuexiji init.d]# chmod +x /etc/rc.d/init.d/named
[root@DNS-XUEXI-xuexiji init.d]# chkconfig --add named
[root@DNS-XUEXI-xuexiji init.d]# chkconfig named on
3、添加相关权限
chown -R named:named /usr/local/bind9/var/named
3、启动测试
[root@DNS-XUEXI-xuexiji ~]# ps -ef|grep named
named10696810 19:04 ?00:00:00 /usr/local/bind9/sbin/named -u named -c /usr/local/bind9/etc/named.conf
root107180 1058670 19:08 pts/200:00:00 grep --color=auto named
[root@DNS-XUEXI-xuexiji ~]# service named restart
BIND9 stop ok
BIND9 start ok
[root@DNS-XUEXI-xuexiji ~]# ps -ef|grep named
named10720310 19:08 ?00:00:00 /usr/local/bind9/sbin/named -u named -c /usr/local/bind9/etc/named.conf
root107211 1058670 19:08 pts/200:00:00 grep --color=auto named
[root@DNS-XUEXI-xuexiji ~]#
【CentOS7源码安装最新版本bind9-开机启动服务设置】4、重启操作系统,系统启动后确认named进程已经自动开启
推荐阅读
- mysql备份和恢复
- MySQL索引事务与存储引擎
- MySQL日志管理备份与恢复
- ingress yaml示例
- #yyds干货盘点#K8S 之 EFK 日志管理系统
- Gradle+Groovy基础篇#yyds干货盘点#
- Python扩展和自定义django-allauth
- Python-适用于Pandas的Bamboolib详细指南
- Python使用Tkinter创建GUI标记表