How to configure startup services Ubuntu

Debian and Ubuntu use the service command to control services and update-rc.d for adding and removing services from start up. Using the service command 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.

List Avaialble Services

Use the status-all switch to list all services which are registered with the OS and issues them a status command. You will then get one of the following displayed next to each service:

  • [ + ] – Services with this sign are currently running.
  • [ – ] – Services with this sign are not currently running..
  • [ ? ] – Services that do not have a status switch.

Sample output:

service --status-all

[ ? ] acpid

[ - ] apparmor

[ ? ] apport

[ ? ] atd

[ - ] bootlogd

[ ? ] console-setup

[ ? ] cron

[ ? ] dbus

[ ? ] dmesg

[ ? ] dns-clean

[ ? ] friendly-recovery

[ ? ] glusterfs-server

[ - ] grub-common

[ ? ] gssd

[ ? ] hostname

[ ? ] hwclock

[ ? ] hwclock-save

[ ? ] idmapd

[ ? ] irqbalance

[ ? ] killprocs

[ ? ] module-init-tools

[ ? ] network-interface

[ ? ] network-interface-container

[ ? ] network-interface-security

[ ? ] networking

[ ? ] ondemand

[ ? ] passwd

[ ? ] plymouth

[ ? ] plymouth-log

[ ? ] plymouth-ready

[ ? ] plymouth-splash

[ ? ] plymouth-stop

[ ? ] plymouth-upstart-bridge

[ ? ] portmap

[ ? ] portmap-wait

[ ? ] pppd-dns

[ ? ] procps

[ ? ] rc.local

[ ? ] resolvconf

[ ? ] rpcbind-boot

[ - ] rsync

[ ? ] rsyslog

[ ? ] screen-cleanup

[ ? ] sendsigs

[ ? ] setvtrgb

[ + ] ssh

[ ? ] statd

[ ? ] statd-mounting

[ - ] stop-bootlogd

[ - ] stop-bootlogd-single

[ ? ] sudo

[ ? ] udev

[ ? ] udev-fallback-graphics

[ ? ] udev-finish

[ ? ] udevmonitor

[ ? ] udevtrigger

[ ? ] ufw

[ ? ] umountfs

[ ? ] umountnfs.sh

[ ? ] umountroot

[ - ] unattended-upgrades

[ - ] urandom

[ ? ] whoopsie

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 -f switch if the applications /etc/init.d start up file exists.

#update-rc.d -f apache2 remove

Add a service

Adding a service to Ubuntu or Debian is done with the update-rc.d command. 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.

#update-rc.d apache2 defaults

Leave a Reply

Your email address will not be published. Required fields are marked *