Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux streamlines the script for booting self-starting service

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

After the operating system starts, some services and programs will be started automatically. Some of these programs are not necessary for the server to function properly.

For the server, running redundant services and programs will not add points to the server, but will bring other hidden dangers:

1. Resource consumption: every time you run an extra service, you take up an extra share of the resource.

two。 Bring security vulnerabilities: every service may have vulnerabilities or potential vulnerabilities. Extra services will increase maintenance costs.

Therefore, it is very necessary to simplify the server self-booting program. For newly installed servers, you can use scripts to streamline services directly, and then deploy the required services. But for a running server, you need to make a judgment when simplifying! Otherwise, after streamlining and restarting, some necessary service processes will not be started automatically, and the restart will directly affect the business.

The following is a simplified script, which shuts down all self-starting services before starting the following services:

Crond: scheduling tasks

Network: network service, control and enable network card

Rsyslog/syslog: operating system log service

Ssh: ssh remote service

Systat: server performance monitoring tool

Iptables: firewall service

Udev-post: dynamic device management

#! / bin/bash# Author:cubix# Date:2017-05-1 roomVersion: 1.such Description:Set mini service for system boot.LANG=en## Stop all services which is auto start on system boot.for SERVICE in `chkconfig-- list | grep "3:on" | awk'{print $1} '`do chkconfig $SERVICE off done # # Set auto start services on system boot.for AUTOSTART in `chkconfig-- list | grep-E' crond | network | rsyslog | syslog | ssh | iptables | udev-post' | awk'{print $1} '`do chkconfig $AUTOSTART-level 345 on done

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report