banner



How To Set A Service To Start Automatically In Ubuntu

It's usually a expert idea to configure essential network services to automatically first on boot. This saves you the hassle of starting them manually upon a reboot and too, the resulting havoc acquired in case you forget to practice and so. Some of the crucial network services include SSH, NTP, and httpd.

Y'all tin ostend what is your organisation service manager by running the following command.

# ps --pid 1        
Check Linux Service Manager
Check Linux Service Manager

Based on the output of the above command, you volition use i of the post-obit commands to configure whether each service should start automatically on boot or not:

On systemd-based
----------- Enable Service to Outset at Boot ----------- # systemctl enable [service]        
----------- Prevent Service from Starting at Boot ----------- # systemctl disable [service] # prevent [service] from starting at boot        
On sysvinit-based
----------- Outset Service at Kicking in Runlevels A and B ----------- # chkconfig --level AB [service] on        
-----------  Don't Start Service at boot in Runlevels C and D ----------- # chkconfig --level CD service off        

On a systemd arrangement like CentOS 8, RHEL viii and Fedora 30+, the systemctl command is used for managing services. For example, to have a view of the disabled services, run the command:

$ sudo systemctl list-unit of measurement-files --state=disabled $ sudo chkconfig --listing     [On sysvinit-based]        

The output below prints out all the disabled services and equally you can run across, the httpd service is listed, implying that information technology is non configured to first on boot.

List Disabled Network Services
List Disabled Network Services

To enable a service to start on kicking, utilize the syntax:

$ sudo systemctl enable service-name $ sudo chkconfig service_name on     [On sysvinit-based]        

For case, to enable httpd service on boot execution.

$ sudo systemctl enable httpd $ sudo chkconfig httpd on     [On sysvinit-based]        

To ostend that the httpd service has been enabled, list all the enabled services by executing the control:

$ sudo systemctl list-unit-files --state=enabled $ sudo chkconfig --list | grep three:on     [On sysvinit-based]        
List Enabled Network Services
Listing Enabled Network Services

From the output above, we can clearly see that the httpd service now appears in the list of enabled services.

To acquire more about systemctl and chkconfig commands, read these following manufactures:

  • How to Manage 'Systemd' Services and Units Using 'Systemctl' in Linux
  • Basic chkconfig Command Examples in Linux

If You Appreciate What We Exercise Here On TecMint, You Should Consider:

TecMint is the fastest growing and nigh trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If y'all like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending back up.

How To Set A Service To Start Automatically In Ubuntu,

Source: https://www.tecmint.com/auto-start-services-on-linux-boot/

Posted by: lyonrild1968.blogspot.com

0 Response to "How To Set A Service To Start Automatically In Ubuntu"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel