On Windows Operating Systems, controlling how services startup can be managed from the Services console. On Linux systems such as Ubuntu, services can be controlled from a similar GUI tool called System Administration tool or from the command line
But before learning how to start, stop or disable services, it's important to understand how Ubuntu determines which programs run during start up.
Pre-Ubuntu versions before 6.10 (Edgy Eft), like many Linux distributions, use the System V init scripts method of initialization (sysvinit) that controls which programs start or do not start during boot. Where Windows uses the registry for starting processes, System V uses scripts (init scripts) located in the /etc/init.d directory.
wtn@WTN2:/etc$ ls -l /etc/init.d
Total 396
-rwxr-xr-x 1 root root 2445 2006-09-15 13:48 acpid
-rwxr-xr-x 1 root root 867 2006-03-28 11:26 acpi-support
-rwxr-xr-x 1 root root 9342 2006-07-30 21:50 alsa-utils
-rwxr-xr-x 1 root root 1015 2006-09-20 10:21 anacron
-rwxr-xr-x 1 root root 1386 2006-07-20 22:16 apmd
-rwxr-xr-x 1 root root 2252 2006-09-28 14:09 apport
-rwxr-xr-x 1 root root 969 2006-07-20 22:15 atd
-rwxr-xr-x 1 root root 3747 2006-09-09 10:34 avahi-daemon
-rwxr-xr-x 1 root root 1109 2005-10-27 08:15 binfmt-support
-rwxr-xr-x 1 root root 6980 2006-10-20 14:02 bluetooth
-rwxr-xr-x 1 root root 3597 2006-10-06 07:34 bootclean
-rwxr-xr-x 1 root root 2121 2006-10-06 07:34 bootlogd
-rwxr-xr-x 1 root root 1883 2006-10-06 07:34 bootmisc.sh
-rwxr-xr-x 1 root root 881 2006-10-11 20:32 brltty
-rwxr-xr-x 1 root root 2887 2006-10-06 07:34 checkfs.sh
-rwxr-xr-x 1 root root 9875 2006-10-06 07:34 checkroot.sh
-rwxr-xr-x 1 root root 6211 2006-09-07 18:36 console-screen.sh
-rwxr-xr-x 1 root root 680 2006-09-22 11:53 console-setup
-rwxr-xr-x 1 root root 1741 2006-07-20 22:14 cron
-rwxr-xr-x 1 root root 2130 2006-10-09 12:54 cupsys
-rwxr-xr-x 1 root root 2545 2006-10-20 07:45 dbus
-rwxr-xr-x 1 root root 795 2006-06-28 19:59 dns-clean
-rwxr-xr-x 1 root root 1196 2006-10-06 10:53 festival
-rwxr-xr-x 1 root root 2590 2006-10-20 19:35 gdm
-rwxr-xr-x 1 root root 6175 2006-10-10 10:46 glibc.sh
-rwxr-xr-x 1 root root 1228 2006-10-06 07:34 halt
-rwxr-xr-x 1 root root 5137 2005-0……..
(Above list is a partial listing of the /etc/init.d directory)
Depending on the circumstance, not every script is run during boot. System V organizes the scripts into run levels that determine which script will start. Most Linux systems have seven run levels, ranging from 0 - 6 and will startup the system into a state as defined by the runlevel listed below:
Runlevel 0 - halts the system
Runlevel 1 - single user mode
Runlevel 2 - single user mode with networking
Runlevel 3 - multiuser mode - boots up in text mode (no GUI just Terminal window)
Runlevel 4 - not used
Runlevel 5 - multiuser mode - boots up in X Windows (GUI)
Runlevel 6 - Reboots the system
Each run level has a directory located in /etc that stores symlinks to certain init scripts in /etc/init.d and are started, depending on the run level being executed. Ubuntu puts symlinks under each run level directory. For example, run level 2 scripts (which is the default run level for Ubuntu), are located in /etc/rc2.d/
Starting with Ubuntu version 6.10, a replacement for sysvinit called Upstart has been implemented. Upstart is an event-based init service that is aiming as the new standard for replacement of init and service management daemon. Upstart startup scripts reside in /etc/event.d directory.
wtn@WTN2:/etc/event.d$ ls -l
total 84
-rw-r-r- 1 root root 246 2006-10-10 06:42 control-alt-delete
-rw-r-r- 1 root root 254 2006-10-10 06:42 logd
-rw-r-r- 1 root root 622 2006-10-10 06:42 rc0
-rw-r-r- 1 root root 566 2006-10-10 06:42 rc0-halt
-rw-r-r- 1 root root 577 2006-10-10 06:42 rc0-poweroff
-rw-r-r- 1 root root 419 2006-10-10 06:42 rc1
-rw-r-r- 1 root root 440 2006-10-10 06:42 rc2
-rw-r-r- 1 root root 440 2006-10-10 06:42 rc3
-rw-r-r- 1 root root 440 2006-10-10 06:42 rc4
-rw-r-r- 1 root root 440 2006-10-10 06:42 rc5
-rw-r-r- 1 root root 494 2006-10-10 06:42 rc6
-rw-r-r- 1 root root 482 2006-10-10 06:42 rc-default
-rw-r-r- 1 root root 487 2006-10-10 06:42 rcS
-rw-r-r- 1 root root 538 2006-10-10 06:42 rcS-sulogin
-rw-r-r- 1 root root 451 2006-10-10 06:42 sulogin
-rw-r-r- 1 root root 257 2006-10-10 06:42 tty1
-rw-r-r- 1 root root 255 2006-10-10 06:42 tty2
-rw-r-r- 1 root root 255 2006-10-10 06:42 tty3
-rw-r-r- 1 root root 255 2006-10-10 06:42 tty4
-rw-r-r- 1 root root 255 2006-10-10 06:42 tty5
-rw-r-r- 1 root root 255 2006-10-10 06:42 tty6
More information on Upstart can be found at http://upstart.ubuntu.com (I will also update this guide with details on Upstart when available).
Viewing Run Levels
To view the current run level, at the command prompt, type runlevel
(NOTE: The output shows the letter N which indicates the system runlevel has not changed from a previous run level)
While Windows does not use runlevels, the concept of run levels can be compared to some Safe Mode options, as well as shutdown (Runlevel 0) and restart (Runlevel 6). But this is where the comparison ends. On Windows, if you wanted to startup in command prompt mode, you will need to reboot. With Ubuntu, you can easily change to different run levels, without rebooting.
From a command prompt just type:
sudo init 6 to shutdown
or
sudo init 1 to enter single user mode.
(To avoid loss of data, it's best to save any data or close applications before executing init command)
Managing Services (deamons)
Now that you have an idea of the boot process, Ubuntu provides a graphical tool for managing services that startup called Services Administration Tool found in System \ Administration \ Services or from a command prompt by typing:
sudo services-admin
Each service includes a checkbox used to enable (checked) or disable (uncheck) a service. To change the service from starting or stopping, right click on the service, select Properties, then click in the Status column next to the desired run level to change the startup type. Click Close when completed.
While the Services Administration Tool provides an easy view of services, it's limited to only changing a service startup Status and Priority at boot. If you want to start, stop or restart services, it's best to use the command line.
>To stop the Printing service, type:
sudo /etc/init.d/cupsys stop
To start the Printing service, type:
sudo /etc/init.d/cupsys start
If you need to just restart the Printing service, type:
sudo /etc/init.d/cupsys restart
to view the status of the Printing service, type:
sudo /etc/init.d/cupsys status
The purpose of this guide is to give Windows users a high level overview of how Ubuntu startup process works and how to manage services (deamons). While many ways exist to manage and configure how Ubuntu starts, you now have the basic foundation needed in understanding what is going on under the hood.
For more information for Windows users using Ubuntu, see Viewing Logs With System Log Viewer On Ubuntu
Comments on Ubuntu Guide For Windows Users: Control Services That Startup
This is wrong.
ubuntu uses upstart http://upstart.ubuntu.com/
Thanks Sam! I have updated the guide and will provide more info on Upstart to this guide soon.