Main Menu

Search

Showing posts with label enable service. Show all posts
Showing posts with label enable service. Show all posts

LINUX: How To Enable Particular Service Using "systemctl" Command To Auto Start During Reboot?

Below "systemctl" Command can be used to enable particular Service.
systemctl enable <service name>

For example if you want to enable Docket service to start when Linux Machine reboots, your "systemctl" command will look as follows:



systemctl enable docker

Once the service is enable run below command to verify that the service is enabled.

systemctl list-unit-files | grep -i <service>

For e.g. if you enabled Docker service, you can run below command to verify whether the Docker service is enabled.
systemctl list-unit-files | grep -i docker.

Below is example output of above command.
# systemctl list-unit-files | grep -i docker
docker.service          enabled


Products to which Article Applies


All Linux Operating Systems

Additional References

https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units

LINUX: How to Enable Service On Linux Nodes Using Systemctl Command? (How To Doc)



On Linux 7 & above versions "chkconfig --list" command cannot be used for enabling the services.
We will have to use systemctl command to check and enable services on Linux 7 and above versions.

Follow below steps to enable the desired service on Linux OS using systemctl command.


1. Check the status of the service using below command.
systemctl list-unit-files | grep -i <service name>


Below is sample output which shows the status of docker as disabled.
# systemctl list-unit-files | grep -i docker
docker.service                                disabled
docker.socket                                 disabled


2. Enable the desired service using below command.
systemctl enable docker


Below is sample snippet of enabling the docker service using systemctl command.
# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.


3. Check the status of the service using below command.
systemctl list-unit-files | grep -i <service name>


You will see that the service is enabled. Below is the sample output which shows docker service as being enabled.
# systemctl list-unit-files | grep -i docker
docker.service                                enabled
docker.socket                                 disabled

Products to which Article Applies


All Host Operating Systems Using ILOM

Additional Reference