UPDATE-RC.D CHEAT SHEET

http://www.jamescoyle.net/tag/cheat-sheet

Debian and Ubuntu use the servicecommand to control services andupdate-rc.d for adding and removing services from start up. Using the servicecommand we can start, stop, restart and display all available services. With update-rc.d we can add and remove services and add them to the Ubuntu/ Debian start up scripts. As Linux operating systems have multiple states, or runlevels, you need to make sure you add any new services to the correct runlevels. For example, you would not want to start a web service application before starting networking.

See my post on runlevels for more information about runlevels in Linux..

What services are available for startup?

Use the status-all switch to list all services which are registered with the OS. The display will also indicate if the service is started during statup.

  • [ + ] – Services with this sign will start at OS boot.
  • [ – ] – Services with this sign do not start at OS boot.

Sample output:

Start a service

Starting a service is done using the command service followed by the service name and the command to start the service.

Stop a service

Use the stop keyword with service to stop a service.

Check the status of a service

Each service has a status, usually running or not running. Some services, such as network, may have a different output and output more information on the service.

Remove a service

Use the remove keyword with update-rc.d to remove the service start up command for an application. You will need to use the -fswitch if the applications /etc/init.d start up file exists.

 Add a service

Adding a service to Ubuntu or Debian is done with the update-rc.dcommand. You can specify which runlevels to start and stop the new service or accept the defaults. The init.d file will be added to the relevent rc.d startup folders.

Let me know in the comments if you think anything is missing.