这篇文章主要介绍“CentOS7中systemctl命令的用法”,在日常操作中,相信很多人在CentOS7中systemctl命令的用法问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”CentOS7中systemctl命令的用法”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
Linux Systemctl是一个系统管理守护进程、工具和库的集合,用于取代System V、service和chkconfig命令,初始进程主要负责控制systemd系统和服务管理器。通过Systemctl –help可以看到该命令主要分为:查询或发送控制命令给systemd服务,管理单元服务的命令,服务文件的相关命令,任务、环境、快照相关命令,systemd服务的配置重载,系统开机关机相关的命令。
systemctl list-unit-files
systemctl list-units
systemctl –failed
systemctl is-enabled crond.service
systemctl list-unit-files –type=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命令可以打印输出。
systemctl is-active mysql.service systemctl enable mysql.service systemctl disable mysql.service
systemctl mask ntpdate.service ln -s /dev/null /etc/systemd/system/ntpdate.service systemctl unmask ntpdate.service rm /etc/systemd/system/ntpdate.service
systemctl kill crond
systemctl list-unit-files –type=mount
systemctl start tmp.mount systemctl stop tmp.mount systemctl restart tmp.mount systemctl reload tmp.mount systemctl status tmp.mount
systemctl is-active tmp.mount systemctl enable tmp.mount systemctl disable tmp.mount
systemctl mask tmp.mount ln -s /dev/null /etc/systemd/system/tmp.mount systemctl unmask tmp.mount rm /etc/systemd/system/tmp.mount
systemctl list-unit-files –type=socket
systemctl show mysql
systemctl list-dependencies httpd.service
systemctl rescue
systemctl emergency
systemctl get-default
systemctl isolate runlevel5.target
或
systemctl isolate graphical.target
systemctl isolate runlevel3.target
或
systemctl isolate multiuser.target
systemctl set-default runlevel3.target systemctl set-default runlevel5.target
systemctl reboot systemctl halt systemctl suspend systemctl hibernate systemctl hybrid-sleep
对于不知运行等级为何物的人,说明如下。
Runlevel 0 : 关闭系统 Runlevel 1 : 救援,维护模式 Runlevel 3 : 多用户,无图形系统 Runlevel 4 : 多用户,无图形系统 Runlevel 5 : 多用户,图形化系统 Runlevel 6 : 关闭并重启机器
到此,关于“CentOS7中systemctl命令的用法”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。