XK0-005 · Question #323
A user wants to configure the application "myapp" to start on runlevels 2, 3, 4, and 5 every time the system starts. Which of the following commands will accomplish this task?
The correct answer is A. chkconfig --level 2345 myapp on. The chkconfig command is used on systems employing SysV init or a hybrid system to manage services across different runlevels. The --level option specifies which runlevels a service should be enabled or disabled for.
Question
A user wants to configure the application “myapp” to start on runlevels 2, 3, 4, and 5 every time the system starts. Which of the following commands will accomplish this task?
Options
- Achkconfig --level 2345 myapp on
- Bsystemctl myapp on 2345
- Cchkcinfig myapp --levels 2-5
- Dsystemctl --levels 2345 on
How the community answered
(68 responses)- A88% (60)
- B7% (5)
- C3% (2)
- D1% (1)
Why each option
The `chkconfig` command is used on systems employing SysV init or a hybrid system to manage services across different runlevels. The `--level` option specifies which runlevels a service should be enabled or disabled for.
The `chkconfig --level 2345 myapp on` command correctly uses `chkconfig` to enable the `myapp` service for specific runlevels (2, 3, 4, and 5). The `--level` option followed by the runlevel numbers is the standard syntax to specify the desired runlevels for a service.
`systemctl` is the command for managing services under systemd, not `chkconfig`, and its syntax for enabling services is `systemctl enable <service-name>`, not using `on 2345` for runlevels.
The correct option is `--level`, not `--levels`, and the runlevels are typically listed consecutively without hyphens like `2345` when using `chkconfig` for multiple levels.
`systemctl` is for systemd, and its syntax is incorrect for specifying runlevels in this manner; systemd uses targets (like `multi-user.target`) rather than traditional runlevels.
Concept tested: Linux service management (chkconfig/runlevels)
Source: https://man7.org/linux/man-pages/man8/chkconfig.8.html
Topics
Community Discussion
No community discussion yet for this question.