首页 > 信息技术 > 红帽认证 > systemd服务开机自启与立即启动

systemd服务开机自启与立即启动

红帽认证 · 考点例题与解析
📘 教材推导
📘 依据出处:该考点依据教材与考试大纲整理,无单一条款出处
单选题
管理员小王需要让httpd服务在系统启动时自动运行,并在当前立即启动该服务。按照systemd管理方式,他应执行哪条命令组合最合适?
A. service httpd start && systemctl enable httpd
B. systemctl start httpd && chkconfig httpd on
C. systemctl enable --now httpd
D. systemctl enable httpd && service httpd start
正确答案:C
依据systemctl(1)手册,enable --now httpd可同时设置开机自启并立即启动服务,是RHEL 7及以后版本的推荐方式;chkconfig为旧版SysV工具,service与systemd混用易产生状态不一致。
单选题
某公司RHEL 8服务器需要让sshd服务开机自启并立即启动。管理员执行了systemctl enable sshd,下一步应执行哪个命令完成立即启动?
A. systemctl enable --now sshd
B. systemctl reload sshd
C. systemctl start sshd
D. service sshd restart
正确答案:C
依据systemctl(1)手册,enable仅设置开机自启,start用于立即启动服务;enable --now可一步完成两者,但题干已执行enable,故应执行systemctl start sshd,reload仅重载配置不启动未运行的服务。

红帽认证·其他考点

进入「systemd服务开机自启与立即启动」专项练习 → 查看红帽认证全部题目 →
内容依据教材推导整理 · 智学通