nerdexam
CompTIA

XK0-004 · Question #296

A Linux administrator has downloaded and installed the httpd package. Which of the following commands will start the service immediately and allow the service to start on system boot?

The correct answer is A. systemctl start httpd;chkconfig httpd on. The correct command pair uses systemctl start to immediately start the httpd service and chkconfig httpd on to enable it persistently at system boot.

System Management

Question

A Linux administrator has downloaded and installed the httpd package. Which of the following commands will start the service immediately and allow the service to start on system boot?

Options

  • Asystemctl start httpd;chkconfig httpd on
  • Bsystemctl status httpd;chkconfig httpd on
  • Csystemctl.start httpd;chkconfig httpd on
  • Dsystemctl start httpd;chkconfig httpd on 6

How the community answered

(16 responses)
  • A
    94% (15)
  • B
    6% (1)

Why each option

The correct command pair uses systemctl start to immediately start the httpd service and chkconfig httpd on to enable it persistently at system boot.

Asystemctl start httpd;chkconfig httpd onCorrect

systemctl start httpd immediately brings the httpd service online in the current running session without requiring a reboot, while chkconfig httpd on registers the service to start automatically on future system boots. Together, these two commands satisfy both requirements - immediate activation and persistent boot-time enablement.

Bsystemctl status httpd;chkconfig httpd on

systemctl status httpd only queries and reports the current state of the httpd service; it does not start the service, so the immediate-start requirement is not fulfilled.

Csystemctl.start httpd;chkconfig httpd on

systemctl.start uses a dot separator instead of a space, which is invalid syntax for the systemctl command and will produce a command not found error at runtime.

Dsystemctl start httpd;chkconfig httpd on 6

chkconfig httpd on 6 attempts to enable the service specifically for runlevel 6, which is the system halt or reboot runlevel; the service would not be enabled for normal multi-user boot runlevels.

Concept tested: Starting and enabling a service with systemctl and chkconfig

Source: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-services

Topics

#systemctl#chkconfig#service management#boot services

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice