/Sbin/Service Not Found on Ubuntu

来源:互联网 发布:淘宝网如何找货源 编辑:程序博客网 时间:2024/05/17 22:47

平时工作中遇到的相关问题解决方案,感觉不错,转载过来分享一下。

By Kristen Waters, eHow Contributor

If you attempt to use the command "sudo /sbin/service service_name start" on a Ubuntu computer, the message "/sbin/service: No such file or directory" will appear. The /sbin/service script is the script used by Red Hat-based Linux distributions to control system services. This script is not found in the same location in the Ubuntu Linux distribution. Instead, Ubuntu has a different method for starting and stopping services. Have a question? Get an answer from online tech support now!


Services Explained

  • A service is a program that runs in the background performing essential tasks or waiting to respond to a request. Services are typically started during the boot process and are owned by the root user. Common services include the "apache2," "mysql," "cron" and "gdm" services. Services can be started and stopped manually by the system administrator. Typically, they are only stopped or restarted when the administrator makes configuration changes to the service or if it is not functioning properly.

Using /etc/init.d Commands

  • The traditional way to manage services on Ubuntu is with the "/etc/init.d/service_name" command, where "service_name" is the name of the service that you want to start. The "/etc/init.d" directory is where the scripts that start the services were traditionally located. Since version 6.10, this directory contains scripts which make the replacement service management method backwards compatible.

    The syntax for managing services using the "/etc/init.d" method is:

    sudo /etc/init.d service_name start|stop|restart

    The command "sudo /etc/init.d service_name start" starts the service. The command "sudo /etc/init.d service_name stop" stops the service. The command "sudo /etc/init.d service_name restart" stops, then restarts the service. The command "ls /etc/init.d" produces a list of all the services.

Using the "service" Command

  • In Ubuntu 6.10, the method for managing services was changed to the "service" command. The syntax is:

    sudo service service_name start|stop|restart

    The command "sudo service service_name start" starts the service. The command "sudo service service_name stop" stops the service. The command "sudo service service_name restart" stops then restarts the service. The command "service --status-all" is used to show the status of all the services. You do not have to use the "sudo" command to view the services.

Using the Graphical User Interface

  • The Ubuntu desktop edition provides a GUI for disabling unwanted services. Click on the "System" menu, highlight the "Administration" option and click on "Services" to open the utility. This starts the Services Settings utility. A list of services appears with a check mark next to the enabled services. Click the "Unlock" button and type the administrator password into the text box to make changes to the services. Place a check mark next to any services you want enabled and remove the check mark next to any services you want to disable. Click the "Close" button to save the changes.



Read more : http://www.ehow.com/info_12024559_sbin-service-not-found-ubuntu.html


0 0
原创粉丝点击