7版本用 systemctrl 来管理服务
6版本用 init 来管理的
systemctrl 的服务通常被称为unit
systemctrl -t help 查看
systemctl enable sshd(设置sshd.service开机启动)
systemctl disable sshd
(static状态是依靠其他服务 不能人为的修改)
systemctl list-units -t service --all
(查询所有的service 活动单元状态)
systemctl list-unit-files -t service
(查看启动配置)
systemctl --failed -t service
(查看启动失败的)
systemctl mask firewalld.service
(mask掉服务,不能进行手动启动,重新启用 umask掉)
(将这个做了一个软连接,umask就是把软连接去掉)
systemctl set-default multi-user.target (设置开机默认的target)
设置默认的target
systemctrl isolate multi-user.target
(切换target)
----------------红帽6版本服务-----------------
所有服务都是脚本 /etc/redhat-release
原始在 /etc/init.d/ 文件下
启动级别(通过修改)
可直接修改 id:数值:initdefault 确定启动级别
(不同的启动级别的服务放在不同的rd编号下)
以K开头的会自动启动 以S开头的不会开机自动启动
chkconfig --list sshd (查看级别启动的状态,全off所有级别都不启动)
chkconfig --level 5 sshon (不加参数就是全部on )
service sshd stop(关闭服务)
通过脚本管理