====== Ubuntu - Services - Start a service ======
The recommended method to use it at the top of this list, but if that does not work try the other methods.
===== Using systemctl =====
systemctl start service_name.service
Example:
systemctl start apache2.service
----
===== Using System V =====
With **sysv-rc-conf** or **sysvconfig** under Debian or Ubuntu Linux.
/etc/init.d/service_name
Example:
/etc/init.d/apache2
----
===== Using Service =====
**service** runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to /.
**service** works in most Linux distributions including Debian and Ubuntu.
service service_name start
Example:
service apache2 start
----
===== Using invoke-rc.d =====
**invoke-rc.d** is a wrapper around running the System V style init script **/etc/init.d/name** directly, obeying runlevel constraints as well as any local policies set by the system administrator.
The policy may cause the command not to be run at all, based on the current runlevel and whether the daemon should be run in that runlevel.
By default, Debian does not differentiate between runlevels 2-5, but as the local administrator, you can change what is run in each runlevel. invoke-rc.d will honor these local policies and not start a daemon if the runlevel is wrong.
According to the man page, all access to init scripts by Debian packages' maintainer scripts should be done through invoke-rc.d.
* [https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt]
* [http://manpages.ubuntu.com/manpages/xenial/man8/invoke-rc.d.8.html]
invoke-rc.d service_name start
Example:
invoke-rc.d apache2 start
----
===== Using Upstart =====
**Upstart** is an event-based replacement for the /sbin/init daemon which handles starting of tasks and services during boot, stopping them during shutdown and supervising them while the system is running.
It was originally developed for the Ubuntu distribution, but is intended to be suitable for deployment in all Linux distributions as a replacement for the venerable System-V init.
**upstart** only works on certain version of Ubuntu.
* [http://upstart.ubuntu.com/]
start service_name