CentOS 7 开始,CentOS 开始使用 systemd 服务来代替daemon,现在来介绍下基本用法
1、启动服务
systemctl start mysqld.service
2、停止服务
systemctl stop mysqld.service
3、重启服务
systemctl restart mysqld.service
4、查看服务状态
systemctl status mysqld.service
5、systemctl 配置重载
systemctl daemon-reload
6、查看服务是否启动
systemctl is-active mysqld.service
7、检查服务是否设置为开机启动
systemctl is-enable mysqld.service
9、注销 mysqld 服务
systemctl mask mysqld.service
10、取消注销cups服务
systemctl unmask cups.service
11、列出所有的系统服务
systemctl
12、列出所有启动 unit
systemctl list-units
13、列出所有启动文件
systemctl list-unit-files
14、列出所有service类型的unit
systemctl list-units --type=service --all
15、查看当前运行级别target(mult-user)启动了哪些服务
[root@localhost ~]# systemctl list-dependencies mysqld
mysqld.service
[root@localhost ~]# systemctl list-dependencies
default.target
● ├─auditd.service
● ├─chronyd.service
● ├─crond.service
● ├─dbus.service
● ├─firewalld.service
● ├─irqbalance.service
● ├─kdump.service
● ├─network.service
● ├─NetworkManager.service
● ├─plymouth-quit-wait.service
● ├─plymouth-quit.service
● ├─rh-nginx116-nginx.service
● ├─rh-php72-php-fpm.service
● ├─rhel-configure.service
● ├─rsyslog.service
● ├─sshd.service
● ├─systemd-ask-password-wal
END
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。