mirror of
https://github.com/spiritLHLS/one-click-installation-script.git
synced 2024-11-16 12:42:19 +08:00
解除进程限制
This commit is contained in:
parent
55f08169b1
commit
cb9788a273
42
repair_scripts/unlimit.sh
Normal file
42
repair_scripts/unlimit.sh
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
#by spiritlhl
|
||||
#from https://github.com/spiritLHLS/one-click-installation-script
|
||||
#version: 2024.06.20
|
||||
|
||||
# 更新 /etc/security/limits.conf 文件
|
||||
echo "更新 /etc/security/limits.conf 文件..."
|
||||
sed -i '/^root soft nofile /d' /etc/security/limits.conf
|
||||
sed -i '/^root hard nofile /d' /etc/security/limits.conf
|
||||
sed -i '/^\* soft nofile /d' /etc/security/limits.conf
|
||||
sed -i '/^\* hard nofile /d' /etc/security/limits.conf
|
||||
echo "root soft nofile 1000000" >> /etc/security/limits.conf
|
||||
echo "root hard nofile 1000000" >> /etc/security/limits.conf
|
||||
echo "* soft nofile 1000000" >> /etc/security/limits.conf
|
||||
echo "* hard nofile 1000000" >> /etc/security/limits.conf
|
||||
|
||||
# 更新 /etc/pam.d/common-session 文件
|
||||
echo "更新 /etc/pam.d/common-session 文件..."
|
||||
if ! grep -q "session required pam_limits.so" /etc/pam.d/common-session; then
|
||||
echo "session required pam_limits.so" >> /etc/pam.d/common-session
|
||||
fi
|
||||
|
||||
# 更新 /etc/pam.d/common-session-noninteractive 文件
|
||||
echo "更新 /etc/pam.d/common-session-noninteractive 文件..."
|
||||
if ! grep -q "session required pam_limits.so" /etc/pam.d/common-session-noninteractive; then
|
||||
echo "session required pam_limits.so" >> /etc/pam.d/common-session-noninteractive
|
||||
fi
|
||||
|
||||
# 更新 /etc/systemd/system.conf 文件
|
||||
echo "更新 /etc/systemd/system.conf 文件..."
|
||||
sed -i '/^DefaultLimitNOFILE=/d' /etc/systemd/system.conf
|
||||
echo "DefaultLimitNOFILE=1000000" >> /etc/systemd/system.conf
|
||||
|
||||
# 更新 /etc/systemd/user.conf 文件
|
||||
echo "更新 /etc/systemd/user.conf 文件..."
|
||||
sed -i '/^DefaultLimitNOFILE=/d' /etc/systemd/user.conf
|
||||
echo "DefaultLimitNOFILE=1000000" >> /etc/systemd/user.conf
|
||||
|
||||
sleep 1
|
||||
|
||||
systemctl daemon-reload
|
||||
echo "请重启服务器使得修改生效"
|
Loading…
Reference in New Issue
Block a user