Starting and Stopping Services Manually

If you change a configuration file for a system service, it is usually necessary to stop and restart the service to make it read the new configuration. If you are reconfiguring the X server, it is often convenient to change from runlevel 5 to runlevel 3 to make testing easier and then switch back to runlevel 5 to re-enable the graphical login. If a service is improperly configured, it is easier to stop and restart it until you have it configured correctly than it is to reboot the entire machine.

The traditional way to manage a service (as root) is to call the service's /etc/init.d name on the command line with an appropriate keyword, such as start, status, or stop. For example, to start the Apache web server, call the /etc/init.d/apache2 script like this:

sudo /etc/init.d/apache2 start
Starting apache 2.0 web server                                 [ OK ]

The script will execute the proper program(s) and report the status of it. Stopping services is equally easy, using the stop keyword.




Copyright @ 2007 OpenSourceProject.org.cn.部分作品为网上收集整理,供开源爱好者学习使用,如侵犯了您的权益,请联系chinaperl@gmail.com,本站将立即删除。