grep -v "^\s*#" /etc/sysctl.conf|grep -c "net.ipv4.ip_forward\s\+=\+0"
];thengrep -v ‘^\s*#‘ /etc/security/limits.conf |grep -c ‘soft nofile‘
-eq 0 ];thenif [ grep -v ‘^\s*#‘ /etc/security/limits.d/20-nproc.conf |grep -c ‘soft nofile‘
-eq 0 ];then
rm -rf /etc/security/limits.d/20-nproc.conf
cp $PACKAGE_DIR/20-nproc.conf /etc/security/limits.d/
fi
if [ grep -v ‘^\s*#‘ /etc/systemd/system.conf |grep -c ‘DefaultLimitCORE=infinity‘
-eq 0 ];then
cat >> /etc/systemd/system.conf <<EOF
DefaultLimitCORE=infinity
DefaultLimitNOFILE=100000
DefaultLimitNPROC=100000
EOF
fi
if [ grep -v ‘^\s*#‘ /etc/systemd/user.conf |grep -c ‘DefaultLimitCORE=infinity‘
-eq 0 ];then
cat >> /etc/systemd/user.conf <<EOF
DefaultLimitCORE=infinity
DefaultLimitNOFILE=100000
DefaultLimitNPROC=100000
EOF
原文地址:http://blog.51cto.com/13718210/2128887