优化启动过程(3)

操作时按↑、↓方向键来选择不同的系统服务,按Space(空格)键设置服务的默认启动状态( [*]表示启动,[ ]表示关闭)。如果要查看所选定服务的说明信息,按 F1键可以获取帮助。

systemctl工具

systemctl工具与ntsysv的功能类似,但是systemctl不提供交互式的操作界面,它用于查询或设置系统服务的默认启动状态。当需要设置某一个服务在当前运行目标中的默认启动状态时,使用systemctl工具会更有效率。

命令格式

systemctl 控制选项 服务名称

常用选项

enable:开机自动启动。

disable:开机自动关闭。

is-enable:查看开机启动状态。

[root@localhost ~]# systemctl enable httpd.service //设置开机自动启动httpd服务 Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@localhost ~]# systemctl is-enabled httpd.service //查看httpd开机启动状态 enabled [root@localhost ~]# systemctl disable httpd.service //设置开机不启动httpd服务 Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service. [root@localhost ~]# systemctl is-enabled httpd.service ////查看httpd开机启动状态 disabled 补充内容

在当前系统下执行systemctl list-units --type=service命令可以查看当前系统中所有已激活的系统服务。

[root@localhost ~]# systemctl list-units --type=service //查看当前系统中所有已激活的系统服务 UNIT LOAD ACTIVE SUB DESCRIPTION abrt-ccpp.service loaded active exited Install ABRT coredump hook abrt-oops.service loaded active running ABRT kernel log watcher abrt-xorg.service loaded active running ABRT Xorg log watcher abrtd.service loaded active running ABRT Automated Bug Reporting Tool accounts-daemon.service loaded active running Accounts Service alsa-state.service loaded active running Manage Sound Card State (restore and store) atd.service loaded active running Job spooling tools auditd.service loaded active running Security Auditing Service avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack blk-availability.service loaded active exited Availability of block devices ...//省略部分内容...

谢谢观看,希望能对大家有所帮助!

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/11655.html