If you are lazy enough just use the service and chkconfig commands. Both distribution has its own mechanism how services or related init scripts are managed from the command line and GUI. The service command is common for both of them and provides a way how to pass right arguments to the proper init script and run an action on a related service, e.g. check the status of a service, restart a service and so on. If you want to configure a runlevel the service should run in use the chkconfig command. The command shares a few arguments between our platforms.
On SLES you can use a symbolic link with prefix "rc" to the current init script. From GUI you can use YaST configuration tool and do the work with mouse. Or you can run an init script directly. For configuring run levels you can choose the insserv command. Short examples will explain the usage of commands on cron (crond on RHEL) service:
- to check the status of cron service run
- rccron status
- /etc/init.d/cron status
- service cron status
- to start the cron service (the same holds for stop or restart action) run
- /etc/init.d/cron start
- rccron start
- service cron start
- to enable the cron service in runlevels defined in the header of its init script run
- insserv cron
- chkconfig --add cron
- to enable the cron service in runlevels 2, 3 and 5 run
- chkconfig --level 235 cron on
RHEL provides ntsysv text based configurator. Its functionality is as the same as of the chkconfig command but with higher comfort. And from the GUI use system-config-services command. Now, follow the same examples:
- to check the status of crond service
- /etc/init.d/crond status
- service crond status
- to start the crond service (the same holds for stop or restart action)
- /etc/init.d/crond start
- service crond start
- to enable the crond service in runlevels defined in the header of its init script run
- ntsysv
- chkconfig --add crond
- to enable the crond service in runlevels 2, 3 and 5 run
- chkconfig --level 235 crond on
I must point out the usage of GUI through the examples was omitted due to obvious reason - it's straightforward. It's interesting to compare both systems and to find out their services are managable via common commands. I'm sure everybody knows how chkconfig is working but do you know about service command? It was hidden for me until now. I will use it.