CentOS7 list-unit-files 设置服务开机启动

[root@stark-ali-ecs ~]# systemctl enable nginx.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

启用开机启动 nginx 服务

[root@stark-ali-ecs ~]# systemctl enable php-fpm.service
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.

启用开机启动 php-fpm 服务

[root@stark-ali-ecs ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

启用开机启动 mariadb 服务

[root@stark-ali-ecs ~]# systemctl list-unit-files | grep enabled

搜索全部已启动的服务,enabled 启用;disabled 禁用。

[root@stark-ali-ecs ~]# systemctl list-unit-files | grep nginx

搜索 nginx 的开机启动状态,nginx 可以换成其他相关服务名称,如 mariadb。