
service --status-all 查看所有服务
service servicename status 查看指定服务状态
service servicename start|stop|restart 启动|停止|重启 指定服务
systemd服务管理系统 如CentOS 7等
systemctl is-enabled servicename.service #查询服务是否开机启动
systemctl enable *.service #开机运行服务
systemctl disable *.service #取消开机运行
systemctl start *.service #启动服务
systemctl stop *.service #停止服务
systemctl restart *.service #重启服务
systemctl reload *.service #重新加载服务配置文件
systemctl status *.service #查询服务运行状态
systemctl --failed #显示启动失败的服务
1.chkconfig: 345 99 01345:表示启动级别。启动级别包括1,2,3,4,5,6,其中常用的是3和5。3表示文字模式启动,5表示图形界面启动。
99:表示系统启动后,每个服务的启动顺序。启动顺序是从标记为00的服务开始。通常不是特别重要的服务可以用99之后数字,如100,101。。。
01:表示系统关闭时,最先关闭的服务。
2.# chkconfig: 345 99 01# description: Nagios network monitor这2句话加在哪儿?
Nagios的配置文件的开头如下所示:
cat /etc/init.d/npcd
#!/bin/sh
#Init Script for NPCD
#chkconfig:345 99 01
#description:Nagios network monitor
。。
3.chkconfig --level 345 smb on
该命令是根据/etc/init.d/smbd文件在/etc/rc.d/rc3.d/和/etc/rc.d/rc4.d/和/etc/rc.d/rc5.d/的目录下建立链接,达到在3,4,5启动级别时开机自动启动的目的。
另外:chkconfig smb on 是在所有启动级别时开机自动启动。
4. 要想开机不启动某个服务怎么设置?~!
chkconfig smb off
是在所有启动级别时开机都不自动启动。
chkconfig --level 345 smb off
是在3,4,5启动级别时开机不自动启动。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)