Ubuntu 解決 Too many open files 問題

meizhengchao發表於2024-05-22
#檢視限制結果 
ulimit -a

# 修改配置
# 刪除最後一行
echo -e "# add_config" | sudo tee -a /etc/security/limits.conf

# 加上文字
echo -e "\n" | sudo tee -a /etc/security/limits.conf
echo -e "mzc  \t  soft  \t  nproc  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "mzc  \t  hard  \t  nproc  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "mzc  \t  soft  \t  nofile  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "mzc  \t  hard  \t  nofile  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "root  \t  soft  \t  nproc  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "root  \t  hard  \t  nproc  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "root  \t  soft  \t  nofile  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "root  \t  hard  \t  nofile  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "\n" | sudo tee -a /etc/security/limits.conf
echo -e "# End of file" | sudo tee -a /etc/security/limits.conf

echo -e "\n" | sudo tee -a /etc/systemd/system.conf 
echo -e "# add_config" | sudo tee -a /etc/systemd/system.conf 
echo -e "DefaultLimitNOFILE=204800" | sudo tee -a /etc/systemd/system.conf 

echo -e "\n" | sudo tee -a /etc/systemd/user.conf 
echo -e "# add_config" | sudo tee -a /etc/systemd/user.conf 
echo -e "DefaultLimitNOFILE=204800" | sudo tee -a /etc/systemd/user.conf 

相關文章