Linux Services
What's another name for runlevel 5?
X11. This is the name of the GUI service used in Linux.
What's the path to the command used to start, stop, and restart services?
/sbin/service. When you issue the service command in the shell, you're running the /sbin/service shell script.
What command will automatically turn the cups service on for runlevels 2, 3, 4, and 5?
chkconfig --cups on
What command turns the cups service off for levels 1 and 5?
chkconfig --level 35 cups off
How would you check to see which services are enabled for the various run levels?
At the command prompt, issue the command chkconfig --list
What's the difference between runlevels 2 and 3?
Both allow multiple users to log in, and both use the CLI only. But runlevel 3 allows networking and runlevel 2 does not.
What are runlevels, and where are they defined?
Runlevels determine the state of the system after it boots. Different services start automatically at different runlevels, giving the system more or less functionality. Runlevels are defined in the file /etc/inittab.
How would you determine your current runlevel?
Issue the command runlevel at the shell prompt.
How would you determine the run levels for which the cups service is enabled?
Run the command chkconfig --list cups.
Which runlevel would you use to recover from a serious system problem? Why?
Runlevel 1. Because few services run at this level--and because it's limited to root--more memory and CPU resources are available.
Which runlevels should never be assigned as the default runlevels? Why?
Runlevels 0 and 6 should never be assigned by default. Runlevel 0 shuts down the system. Runlevel 6 restarts it.
Identify and define: /etc/init.d
This is the directory where the scripts triggered by the service command are stored. (In reality, it contains links scripts in the /etc/rc.d/init.d directory.
What command is issued to see the status of all services?
service --status-all
To see the status of the crond service only, what command would you use?
service crond status
To restart the cups service, what command would you use?
service cups restart
To stop the sshd service, what command would you used?
service sshd stop