XK0-004 · 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 the correct SysV-init tool for enabling a service on specific runlevels, and its syntax requires --level followed by concatenated runlevel digits.
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
- Cchkcinfig myapp --levels 2-5
- Dsystemctl --levels 2345 on
How the community answered
(31 responses)- A87% (27)
- C3% (1)
- D10% (3)
Why each option
The chkconfig command is the correct SysV-init tool for enabling a service on specific runlevels, and its syntax requires --level followed by concatenated runlevel digits.
The command 'chkconfig --level 2345 myapp on' correctly uses the chkconfig utility to enable 'myapp' at runlevels 2, 3, 4, and 5. The --level flag accepts a concatenated string of runlevel digits, and specifying 'on' sets the service to start automatically at those runlevels, persisting the configuration across reboots via the /etc/rc.d symlinks.
'chkcinfig' is a misspelling of chkconfig, and '--levels 2-5' is not valid syntax - the correct flag is '--level' (singular) and runlevels must be listed as concatenated digits, not a hyphenated range.
systemctl does not accept a --levels flag; on systemd-based systems services are enabled with 'systemctl enable', and systemd uses targets rather than numeric runlevel notation.
Concept tested: chkconfig service runlevel management on Linux
Source: https://linux.die.net/man/8/chkconfig
Topics
Community Discussion
No community discussion yet for this question.