Using the service utility

Interix includes a utility called service(1) that serves as a command-line interface to the Windows Service Control Manager. In Windows, you manage services through the Services administrative utility in Control Panel; in Interix, you use the service utility.

Caution

The service command is used to administer services. You can use service to do the following:

To perform most actions with the service command, you must log on as administrator. Below are several examples of how to use service. Type all of these commands at the Interix shell prompt. The word service refers to the service that is being managed.

To start a service with the command, type:

service start service

To stop a service with the command, type:

service stop service

To remove a service with the command, type:

service remove service

By default, services installed with the service command are set to start automatically when you start your system. This means the programs are started even before a logon prompt is available.

If you are installing a newer version of Interix, no Interix subsystem processes can be running. In fact, no services can be running since the last reboot. You can accomplish this by setting the start mode of Interix-based services to manual and then rebooting. The following command prevents a service from starting automatically:

service update -n service -s manual

Once the system has rebooted and the update has been performed, you can reset the start mode of the service with the following command:

service update -n service -s auto

With the service utility, you can run any Interix command as a service; however, most commands are not well suited to run as services. For example, most commands exit or try to make use of standard input, output, or error. Programs that try to display information will also run into problems. Ports of daemons are the best candidates for running as services.