Mac OS 下面修改打开文件数限制:
创建文件:
vi /Library/LaunchDaemons/limit.maxfiles.plist
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>limit.maxfiles</string> <key>ProgramArguments</key> <array> <string>launchctl</string> <string>limit</string> <string>maxfiles</string> <string>65536</string> <string>65536</string> </array> <key>RunAtLoad</key> <true/> <key>ServiceIPC</key> <false/> </dict> </plist>
|
配置系统自动加载:
1 2 3
| sudo chown -R root:wheel /Library/LaunchDaemons/limit.maxfiles.plist sudo chmod -R 644 /Library/LaunchDaemons/limit.maxfiles.plist sudo launchctl load /Library/LaunchDaemons/limit.maxfiles.plist
|
如需修改进程数限制可以创建:
vi /Library/LaunchDaemons/limit.maxproc.plist
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>limit.maxproc</string> <key>ProgramArguments</key> <array> <string>launchctl</string> <string>limit</string> <string>maxproc</string> <string>4096</string> <string>4096</string> </array> <key>RunAtLoad</key> <true /> <key>ServiceIPC</key> <false /> </dict> </plist>
|
加载方式类似