Setup Linux boot-up service via chkconfig-old boy Linux Ops learning Note 1

Source: Internet
Author: User
Tags rsyslog egrep

original works, allow reprint, please be sure to mark the article in the form of hyperlinks Original source , author information and this statement. Otherwise, the legal liability will be investigated.

For more information, see the old boy's teacher's book: "Learn Linux operations with older boys: Web cluster Combat" or operations courses.


First look at what services are currently open:

The old boy teacher's experience tells us that the default is only to open the following 5 essential services:

Sshd |sysstat|crond|network|rsyslog


First look at what the current self-initiated service is. Because the working environment basically uses text mode level 3, you only need to look for services that are open on level 3.

The command is as follows:

[[email protected] ~]# lang=en (first adjust to English character set to facilitate filtering of strings)


[[email protected] ~]# chkconfig--list |grep 3:on (View all self-initiated services at level 3)

Abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 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

Blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off

Cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off

Crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off

Ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Irqbalance 0:off 1:off 2:off 3:on 4:on 5:on 6:off

Lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off

Mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Messagebus 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off

Network 0:off 1:off 2:on 3:on 4:on 5:on 6:off

NFS 0:off 1:off 2:off 3:on 4:off 5:off 6:off

Nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off

Postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off

RPCGSSD 0:off 1:off 2:off 3:on 4:on 5:on 6:off

Rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off

sshd 0:off 1:off 2:off 3:on 4:off 5:off 6:off

Sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off

Udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off


Processing ideas:


1. Turn off all services first, then turn on the one that needs to be reserved (by default, only 5 necessary services can be opened.) )

Operation Process:

[Email protected] ~]# chkconfig--list |grep 3:on |awk ' {print ' Chkconfig ', $, ' off '} ' |bash

(Turn off all self-initiated services)

[[email protected] ~]# chkconfig--list (see if all self-service is off)

Abrt-ccpp 0:off 1:off 2:off 3:off 4:off 5:off 6:off

ABRTD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Acpid 0:off 1:off 2:off 3:off 4:off 5:off 6:off

ATD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

AUDITD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Blk-availability 0:off 1:on 2:off 3:off 4:off 5:off 6:off

Cpuspeed 0:off 1:on 2:off 3:off 4:off 5:off 6:off

Crond 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Haldaemon 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Ip6tables 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Iptables 0:off 1:off 2:on 3:off 4:on 5:on 6:off

Irqbalance 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Kdump 0:off 1:off 2:off 3:off 4:on 5:on 6:off

Lvm2-monitor 0:off 1:on 2:off 3:off 4:off 5:off 6:off

Mdmonitor 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Messagebus 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Netfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Network 0:off 1:off 2:off 3:off 4:off 5:off 6:off

NFS 0:off 1:off 2:off 3:off 4:off 5:off 6:off

NFS-RDMA 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Nfslock 0:off 1:off 2:off 3:off 4:off 5:off 6:off

NTPD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Postfix 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Psacct 0:off 1:off 2:off 3:off 4:off 5:off 6:off

QUOTA_NLD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off

RDMA 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Rngd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Rpcbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off

RPCGSSD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

RPCSVCGSSD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Rsyslog 0:off 1:off 2:off 3:off 4:off 5:off 6:off

SASLAUTHD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

SMARTD 0:off 1:off 2:off 3:off 4:off 5:off 6:off

sshd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Svnserve 0:off 1:off 2:off 3:off 4:off 5:off 6:off

Sysstat 0:off 1:on 2:off 3:off 4:off 5:off 6:off

Udev-post 0:off 1:on 2:off 3:off 4:off 5:off 6:off


Then execute a command to open 5 services that require self-booting:

[Email protected] ~]# chkconfig--list |grep 3:off|egrep "Sshd|sysstat|crond|network|rsyslog" |awk ' {print ' Chkconfig ", $," on "} ' |bash (Turn off all self-service after starting the 5 services that require self-booting)


[[email protected] ~]# chkconfig--list |grep 3:on (query settings and see if we only retain the 5 self-starting services we need)

Crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Network 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off

sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off



2. Turn off unwanted, because the services we need are turned on by default.

Operation Process:

[Email protected] ~]# chkconfig--list |grep 3:on|egrep-v "Sshd|sysstat|crond|network|rsyslog" |awk ' {print ' Chkconfig ", $," Off "} ' |bash

(one command excludes 5 self-booting services we need to keep and shuts down other services)


[[email protected] ~]# chkconfig--list |grep 3:on (query settings and see if we only retain the 5 self-starting services we need)

Crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Network 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off

sshd 0:off 1:off 2:off 3:on 4:off 5:off 6:off

Sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off



The 2nd approach is a bit simpler. You can use it flexibly as needed.


Set up self-starting services can also be handled through setup and NTSYSV.


This article comes from " David 's Linux Operations Learning Blog, be sure to keep this source.

This article is from the David Brother Linux Operations Learning blog, so be sure to keep this source http://davidge.blog.51cto.com/148442/1928714

Setup Linux boot-up service via chkconfig-old boy Linux Ops learning Note 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.