From b97efff9eee90ab611005fa37ff0a908feb90240 Mon Sep 17 00:00:00 2001 From: Weston Schmidt Date: Thu, 28 Feb 2019 18:00:01 -0800 Subject: [PATCH] Split the ulimit value from the kernel limit value. --- etc/caduceus/caduceus.env.example | 1 + etc/init.d/caduceus | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/etc/caduceus/caduceus.env.example b/etc/caduceus/caduceus.env.example index 4ae21a83..baaeed0b 100644 --- a/etc/caduceus/caduceus.env.example +++ b/etc/caduceus/caduceus.env.example @@ -1,3 +1,4 @@ +#KERNEL_OPEN_FILES=95000 #ULIMIT_OPEN_FILES=75000 #NET_CORE_SOMAXCONN=1000 #NET_IPV4_TCP_MAX_SYN_BACKLOG=1000 diff --git a/etc/init.d/caduceus b/etc/init.d/caduceus index a65e329e..13c50964 100644 --- a/etc/init.d/caduceus +++ b/etc/init.d/caduceus @@ -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