Skip to content

Commit

Permalink
Split the ulimit value from the kernel limit value. (#35)
Browse files Browse the repository at this point in the history
* Split the ulimit value from the kernel limit value.

* Only fix the limits.
  • Loading branch information
schmidtw authored and njharter committed May 18, 2019
1 parent 6c56e03 commit 6b8916c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions etc/init.d/petasos
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ RETVAL=0

# Set limits here in addition to limits.conf
#-------------------------------------------------------------------------------
if [ -n "$ULIMIT_OPEN_FILES" ]; then
sysctl -w fs.file-max=$ULIMIT_OPEN_FILES > /dev/null
if [ -n "$KERNEL_OPEN_FILES" ]; then
sysctl -w fs.file-max=$KERNEL_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "fs.file-max=$ULIMIT_OPEN_FILES failed" && exit $RETVAL
[ $RETVAL -ne 0 ] && echo "fs.file-max=$KERNEL_OPEN_FILES failed" && exit $RETVAL

sysctl -w fs.nr_open=$ULIMIT_OPEN_FILES > /dev/null
sysctl -w fs.nr_open=$KERNEL_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "fs.nr_open=$ULIMIT_OPEN_FILES failed" && exit $RETVAL

[ $RETVAL -ne 0 ] && echo "fs.nr_open=$KERNEL_OPEN_FILES failed" && exit $RETVAL
fi
if [ -n "$ULIMIT_OPEN_FILES" ]; then
ulimit -n $ULIMIT_OPEN_FILES > /dev/null
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "ulimit -n $ULIMIT_OPEN_FILES failed" && exit $RETVAL
Expand All @@ -47,6 +48,7 @@ if [ -n "$NET_IPV4_TCP_MAX_SYN_BACKLOG" ]; then
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "net.ipv4.tcp_max_syn_backlog=$NET_IPV4_TCP_MAX_SYN_BACKLOG failed" && exit $RETVAL
fi

#-------------------------------------------------------------------------------

start() {
Expand Down
1 change: 1 addition & 0 deletions etc/petasos/petasos.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#KERNEL_OPEN_FILES=95000
#ULIMIT_OPEN_FILES=75000
#NET_CORE_SOMAXCONN=1000
#NET_IPV4_TCP_MAX_SYN_BACKLOG=1000
Expand Down

0 comments on commit 6b8916c

Please sign in to comment.