/Sbin/Service Not Found on Ubuntu

原文链接

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.

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.

Reference

UbuntuBootupHowto
Linux.com: An Introduction to Services, Runlevels and rc.d Scripts; Jan. 11, 2006

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值