Ubuntu how to start service automatically on boot


--- Start/stop service ---


service servicename start


example: service ssh start, service networking start


--- make service start on boot ---


sudo update-rc.d servicename enable

or

sudo update-rc.d servicename defaults


OR (this did not worked to me)


vi /etc/rc.local

this is file executed on boot probably (im not sure), add line into this file like:

service ssh start

save by writing: :w

Centos/Redhat how to start service automatically on boot

--- Start/stop service ---

service servicename start


example: service ssh start, service networking start


--- make service start on boot ---

chkconfig servicename on