System-V init service. Questions about how Ubuntu uses System-V like scripts to start/stop services at runlevels and it behavior, you should also check systemd and upstart for creation of newer scrips.
System-V-like scripts are run by the init process at boot, and whenever it was changed the run-level. These scripts are stored in the /etc/init
directory in Ubuntu with symlinks to the different rcX.d
directories accordingly with their run levels (X is each run level that vary between 1-6 in Ubuntu).
The common scripts are made of: name, description, start/stop commands.