#!/bin/bash
fileMax=$(grep "fs.file-max" /etc/sysctl.conf | wc -l)
if [ $fileMax -eq 1 ];then
sed -i '/fs.file-max/c\fs.file-max = 70000' /etc/sysctl.conf
else
sed -i '$a\fs.file-max = 70000' /etc/sysctl.conf
fi

nofileMax=$(grep "soft nofile" /etc/security/limits.conf | wc -l)
if [ $nofileMax -eq 1 ];then
sed -i '/soft nofile/c\* soft nofile 10000' /etc/security/limits.conf
else
sed -i '$a\* soft nofile 10000' /etc/security/limits.conf
fi

hdfileMax=$(grep "hard nofile" /etc/security/limits.conf | wc -l)
if [ $hdfileMax -eq 1 ];then
sed -i '/hard nofile/c\* hard nofile 30000' /etc/security/limits.conf
else
sed -i '$a\* hard nofile 30000' /etc/security/limits.conf
fi

sysctl -p

Linux 修改最大连接数脚本的更多相关文章

  1. Linux修改SSH连接数 重启SSH服务

    系统 linux,增加SSH终端连接数最大为1000个 解决方案: vi /etc/ssh/sshd_config 输入/MaxStartups 定位到如下并修改 1)        #MaxStar ...

  2. Linux修改主机名脚本-不重启-支持RedHat、SUSE

    需要用脚本修改主机名,涉及RedHat.SUSE系统,并且要求修改立即生效且不重启,下面就是我的脚本. 使用脚本的方法如下: 1 首先创建一个脚本文件,假如命名为ModifyHostname.sh: ...

  3. 修改linux系统TCP连接数

    修改linux系统TCP连接数 centOS 6.x (1)vi /etc/sysctl.conf (2)添加参数 net.nf_conntrack_max = 655360 (3)sysctl -p ...

  4. Linux下定时执行脚本(转自Decode360)

    文章来自:http://www.blogjava.net/decode360/archive/2009/09/18/287743.html Decode360's Blog  老师(业精于勤而荒于嬉 ...

  5. Linux 服务器系统监控脚本 Shell【转】

    转自: Linux 服务器系统监控脚本 Shell - 今日头条(www.toutiao.com)http://www.toutiao.com/i6373134402163048961/ 本程序在Ce ...

  6. Odoo Linux服务器一键安装脚本使用指南

    Odoo安装脚本介绍 为了帮助更多Linux服务器维护人员快速部署Odoo,为此开源智造(OSCG)基于André Schenkels曾经开放的openerp-install-scripts所构建的基 ...

  7. MYSQL 查看最大连接数和修改最大连接数

    MySQL查看最大连接数和修改最大连接数 1.查看最大连接数show variables like '%max_connections%';2.修改最大连接数set GLOBAL max_connec ...

  8. 在Linux中执行.sh脚本,异常

    在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory. 分析:这是不同系统编码格式引起的:在windows系统中 ...

  9. linux下实现shell脚本自动连接mongodb数据库并创建索引

    在linux下创建shell脚本

随机推荐

  1. leetcode Kth Largest Element in a Stream——要熟悉heapq使用

    703. Kth Largest Element in a Stream Easy Design a class to find the kth largest element in a stream ...

  2. ajax请求成功前,加载中loading显示

    /*第一次刷新--非定时器刷新数据*/ var fistInitColumn = true; var getAllColumnDatas = function(){ var params = {}; ...

  3. puppeteer 爬虫 pdf 截图 自动化

    puppeteer简介 puppeteer 翻译是操纵木偶的人,利用这个工具,我们能做一个操纵页面的人.puppeteer是一个nodejs的库,支持调用Chrome的API来操纵Web,相比较Sel ...

  4. 洛谷 P4515 [COCI2009-2010#6] XOR

    题意 平面直角坐标系中有一些等腰直角三角形,且直角边平行于坐标轴,直角顶点在右下方,求奇数次被覆盖的面积.N<=10.输入为x,y,r,分别表示三角形顶点的坐标与三角形的边长. 如: 总面积为0 ...

  5. 【阅读笔记】《C程序员 从校园到职场》第三章 程序的样式(大括号)

    参考: https://blog.csdn.net/zhouzhaoxiong1227/article/details/22820533 一..初始化数组变量 在实际的软件开发项目中,变量在使用前应初 ...

  6. python中list方法总结

    stu=[s1,s2,s3,s4,s5] #list列表/数组 列表的下标/索引是从0开始的: 定义一个列表:XX=[,,,,,] 定义一个空列表:XX=[] or XX=list() #增加一个元素 ...

  7. flask使用配置文件

    引入配置 app = Flask(__name__) app.config.from_pyfile('config.py') config.py DEBUG = True SECRET_KEY = '

  8. Java实现随机生成车牌号

    String[] citys = {"津","京","宁"}; String sectionNamePre = "断面" ...

  9. xml文档的读取

    #! /usr/bin/env python3 # -*- coding:utf-8 -*- import xml.dom.minidom  #该模块被用来处理xml文件 #打开xml文档 dom=x ...

  10. Cracking The Coding Interview4.8

    //You are given a binary tree in which each node contains a value. Design an algorithm to print all ...