Linux server-setup service startup
Set Service Switch
Users can set a service to start or close, there are two ways: graphical interface and command.
1. Graphical interface
1) Enter the command setup in the terminal, and select "System Service" in the pop-up interface.
2) You can also enter the command "ntsysv" directly in the terminal to get the following interface.
3) Modify the opening or closing by space, move up and down left and right keys, tab key back to "OK" or "Cancel", enter confirmation.
2. Command mode
1) Set the default startup or shutdown state of the service by using the command "chkconfig". The usage of this command is as follows
command
description
chkconfig --list
View startup status of all services
chkconfig -list service name
View the startup status of a specified service
chkconfig -add service name
Add specified services
chkconfig -del service name
Delete specified services
chkconfig -level num(0~6) Service name on/off
Sets the startup status of the specified service at a certain level
2) View startup status of all services
[root@localhost ~]# chkconfig --list
NetworkManager 0: Off 1: Off 2: On 3: On 4: On 5: On 6: Off
abrt-ccpp 0: Off 1: Off 2: Off 3: Enabled 4: Off 5: Enabled 6: Off
abrtd 0: Off 1: Off 2: Off 3: On 4: Off 5: On 6: Off
acpid 0: Off 1: Off 2: On 3: On 4: On 5: On 6: Off
atd 0: Off 1: Off 2: Off 3: On 4: On 5: On 6: Off
auditd 0: Off 1: Off 2: On 3: On 4: On 5: On 6: Off
autofs 0: Off 1: Off 2: Off 3: On 4: On 5: On 6: Off
3) Take the nfs service as an example, check the startup status of the service at each level.
[root@localhost ~]# chkconfig --list nfs
nfs 0: Off 1: Off 2: Off 3: Off 4: Off 5: Off 6: Off
4) Set the nfs service to boot at level5 and view the results
[root@localhost ~]# chkconfig --level 5 nfs on
[root@localhost ~]# chkconfig --list nfs
nfs 0: Off 1: Off 2: Off 3: Off 4: Off 5: Enabled 6: Off
5) Meaning of each level
level
description
shutdown
1
single-user mode
2
Multi-user command mode, no network
3
Multi-user command mode with network
4
reservations
5
Multi-user mode of graphical interface
6
restart