use ulimit -n instead of change the limits globally

This commit is contained in:
FezVrasta 2015-06-25 15:37:36 +02:00
parent 0066063c2d
commit 10a6b21312
2 changed files with 4 additions and 19 deletions

View File

@ -10,25 +10,7 @@ We assume you have created the `steam` user to store steamcmd and your ARK serve
## Requirements
### Increase max open files
Edit /etc/sysctl.conf and set:
```
fs.file-max=100000
```
Edit /etc/security/limits.conf and set these limits:
```
* soft nofile 100000
* hard nofile 100000
```
Add the following line to `/etc/pam.d/common-session` (Debian/Ubuntu) or `/etc/pam.d/system-auth` (RHEL/CentOS/Fedora):
```
session required pam_limits.so
```
After these edits, you'll need to restart your bash session or reconnect to your SSH shell to make the changes effective.
### Open firewall ports
To allow your ARK server to communicate with the outside you have to open some ports in your firewall:
```sh
iptables -I INPUT -p udp --dport 27016 -j ACCEPT

View File

@ -34,6 +34,7 @@ timestamp=$( date +%T )
GREEN="\\033[1;32m"
RED="\\033[1;31m"
NORMAL="\\033[0;39m"
maxOpenFiles=100000
arkmanagerLog="arkmanager.log" # here are logged the actions performed by arkmanager
arkserverLog="arkserver.log" # here is logged the output of ShooterGameServer
@ -187,6 +188,8 @@ doStart() {
arkserveropts="${arkserveropts}?listen"
# run the server in background
echo "$timestamp: start" >> "$logdir/$arkserverLog"
# set max open files limit before we start the server
ulimit -n $maxOpenFiles
nohup "$arkserverroot/$arkserverexec" "$arkserveropts" </dev/null >"$logdir/$arkserverLog" 2>&1 & # output of this command is logged
echo "$timestamp: start" >> "$logdir/$arkmanagerLog"
tput rc; tput ed;