Linux Services (service, chkconfig, system-config-services)
Remember, the exams are hands-on, so it doesn't matter which method you use to achieve the result, so long as the end product is correct.
service command is used to stop, start, restart and check the status of a specified service.
# service httpd stop # service httpd start # service httpd restart # service httpd status
Use the following command to get the status of all services.
# service --status-all
To fully restart a service (a separate stop then start) use the following command.
# service httpd --full-restart
The auto-start toggles for services are also available using a text-based tool initiated from the command line using the
chkconfig command performs a number of service management tasks. To enable and disable services to auto-start at reboot, use the following commands.
# chkconfig httpd on # chkconfig httpd off
The "--level" flag allows auto-start to be limited to specific run levels.
# chkconfig --level 35 httpd on
The "--list" option displays all the run levels a specific service is associated with.
# chkconfig --list httpd httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off #
The "-add" and "-del" options are used to initiate and drop management of a service, based on an init script in the "/etc/init.d" directory. When using "-add", the content of the init script determines which run levels the service is assigned to. An example of using the "-add" to manually create a new service is shown here.
The "Service Configuration" dialog is available from the menu (System > Administration > Services) or directly from the command line by running the
The "Enable" and "Disable" buttons are used to toggle the auto-start on reboot for each service. The "Start", "Stop" and "Restart" buttons affect the current state of the service.
Creating Linux Services
Although not necessary for the RHCSA exam, it's an important topic for Oracle database administrators. For an example of creating a service in Linux, check out this article.
For more information see:
- RHEL6 Documentation
- Linux man pages
- RHCSA and RHCE
- Automating Database Startup and Shutdown on Linux (Creating a Linux Service)
Hope this helps. Regards Tim...