使用Systemctl控制并管理服务

大谋儿 知识探索 1517 0

1. 列出所有服务(包括启用的和禁用的)

# systemctl list-unit-files --type=service


2. 启动、重启、停止、重载服务以及检查服务(如 httpd.service)

# systemctl start httpd.service
# systemctl restart httpd.service
# systemctl stop httpd.service
# systemctl reload httpd.service
# systemctl status httpd.service


注意:当我们使用systemctl的start,restart,stop和reload命令时,我们不会从终端获取到任何输出内容,只有status命令可以打印输出。


3. 如何激活服务并在启动时启用或禁用服务(即系统启动时自动启动服务)

# systemctl is-active httpd.service
# systemctl enable httpd.service
# systemctl disable httpd.service


4. 如何屏蔽(让它不能启动)或显示服务(如 httpd.service)

# systemctl mask httpd.service
# systemctl unmask httpd.service


5. 使用systemctl命令杀死服务(如 httpd.service)

# systemctl kill httpd
# systemctl status httpd


使用Systemctl控制并管理挂载点

6. 列出所有系统挂载点

# systemctl list-unit-files --type=mount


7. 挂载、卸载、重新挂载、重载系统挂载点并检查系统中挂载点状态

# systemctl start tmp.mount
# systemctl stop tmp.mount
# systemctl restart tmp.mount
# systemctl reload tmp.mount
# systemctl status tmp.mount


8. 在启动时激活、启用或禁用挂载点(系统启动时自动挂载)

# systemctl is-active tmp.mount
# systemctl enable tmp.mount
# systemctl disable tmp.mount


9. 在Linux中屏蔽(让它不能启用)或可见挂载点

# systemctl mask tmp.mount
# systemctl unmask tmp.mount


正文结束

相关文章

评论列表

暂时还没有人评论哦,来占个沙发吧?

发表评论