+4 votes
384 views
Configure Network Service Linux Autostart at startup

in Linux / Unix by (552k points)
reopened | 384 views

1 Answer

+5 votes
Best answer

How to allow a network service to run automatically on Linux boot

The Linux operating systems handle various services that allow optimal operation of all the elements that integrate and network services such as SSH, NTP or httpd are essential when working with different tasks either local or external..

 

As a general rule, many of these services must be executed manually (start, stop or restart) and that is why one of the most fundamental and practical tasks is to allow some of the network services to be started automatically in system startup.

 

This undoubtedly apart from saving time allows these services to be available at all times. Next we will see with TechnoWikis how to configure a network service automatically in Linux during startup..

 

 

How to allow a network service to run automatically on Linux boot

 

Step 1

First of all, we must identify the system services administrator with the following command:
 ps --pid 1 

image

 

Step 2

In this case we see that the operating system is based on systemd, in other cases it will be init.
The syntax to use in the case of systemd for a service to be executed at startup is as follows:
 systemctl enable [service] 
To prevent the service from starting at startup we execute:
 systemctl disable [service] 
Step 3

For example, we enable NTP with the following command:
 systemctl enable ntp 
We must enter the administrator password to confirm the process:

 

 

image

 

Step 4

After this we will see the complete process:

 

image

 

Step 5

In the case of init-based systems we must execute the following:

 

For the service to start on Runlevels A and B:

 chkconfig --level AB [service] on 
So that the service does not start in Runlevels C and D:
 chkconfig --level CD service off 
Step 6

In the case of operating systems such as Red Hat, CentOS or Fedora, we can use the command systemctl to manage the disabled services, we will use the following:
 sudo systemctl list-unit-files --state = disabledsudo chkconfig --list (based on sysvinit) 
image

 

Step 8

To list the enabled services we execute:
 sudo systemctl list-unit-files --state = enabledsudo chkconfig --list | grep 3: on (sysvinit based) 
image

 

It's that simple to activate a network service at Linux startup and optimize this type of task.

 


by (3.5m points)

Related questions

+4 votes
1 answer
asked Nov 1, 2019 in Linux / Unix by backtothefuture (552k points) | 330 views
+4 votes
1 answer
asked Oct 9, 2019 in Linux / Unix by backtothefuture (552k points) | 482 views
+3 votes
1 answer
asked Sep 29, 2019 in Linux / Unix by backtothefuture (552k points) | 760 views
+3 votes
1 answer
+5 votes
1 answer
asked May 22, 2019 in Linux / Unix by backtothefuture (552k points) | 194 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users