|
| 1 | +$NetBSD$ |
| 2 | + |
| 3 | +Warn against non-SMF usage, increase file descriptors. |
| 4 | + |
| 5 | +--- deps/node_package/priv/base/runner.orig 2014-10-14 17:01:01.000000000 +0000 |
| 6 | ++++ deps/node_package/priv/base/runner |
| 7 | +@@ -170,11 +170,22 @@ bootstrapd() { |
| 8 | + } |
| 9 | + |
| 10 | + do_start() { |
| 11 | ++ if [ "${SMF_METHOD}" != "start" ]; then |
| 12 | ++ echo "***" |
| 13 | ++ echo "Warning: please use 'svcadm enable $SCRIPT' instead" |
| 14 | ++ echo "***" |
| 15 | ++ fi |
| 16 | ++ |
| 17 | + # Make sure there is not already a node running |
| 18 | + node_down_check |
| 19 | + |
| 20 | +- # Warn the user if ulimit is too low |
| 21 | +- check_ulimit |
| 22 | ++ # Make sure we have access to enough file descriptors |
| 23 | ++ ULIMIT_S=$(prctl -n process.max-file-descriptor -t basic -P $$ | awk '/max-file-descriptor/ { print $3 }') |
| 24 | ++ ULIMIT_H=$(prctl -n process.max-file-descriptor -t priv -P $$ | awk '/max-file-descriptor/ { print $3 }') |
| 25 | ++ if [ ${ULIMIT_S} -lt ${ULIMIT_H} ]; then |
| 26 | ++ echo "Trying to raise the file descriptor limit to maximum allowed." |
| 27 | ++ prctl -n process.max-file-descriptor -t basic -v ${ULIMIT_H} $$ || true |
| 28 | ++ fi |
| 29 | + |
| 30 | + # Make sure log directory exists |
| 31 | + mkdir -p $RUNNER_LOG_DIR |
| 32 | +@@ -222,6 +233,12 @@ do_start() { |
| 33 | + } |
| 34 | + |
| 35 | + do_stop() { |
| 36 | ++ if [ "${SMF_METHOD}" != "stop" ]; then |
| 37 | ++ echo "***" |
| 38 | ++ echo "Warning: please use 'svcadm disable $SCRIPT' instead" |
| 39 | ++ echo "***" |
| 40 | ++ fi |
| 41 | ++ |
| 42 | + get_pid |
| 43 | + ES=$? |
| 44 | + if [ "$ES" -ne 0 ] || [ -z $PID ]; then |
| 45 | +@@ -324,8 +341,13 @@ case "$1" in |
| 46 | + exit $ES |
| 47 | + fi |
| 48 | + |
| 49 | +- # Warn the user if ulimit -n is less than the defined threshold |
| 50 | +- check_ulimit |
| 51 | ++ # Make sure we have access to enough file descriptors |
| 52 | ++ ULIMIT_S=$(prctl -n process.max-file-descriptor -t basic -P $$ | awk '/max-file-descriptor/ { print $3 }') |
| 53 | ++ ULIMIT_H=$(prctl -n process.max-file-descriptor -t priv -P $$ | awk '/max-file-descriptor/ { print $3 }') |
| 54 | ++ if [ ${ULIMIT_S} -lt ${ULIMIT_H} ]; then |
| 55 | ++ echo "Trying to raise the file descriptor limit to maximum allowed." |
| 56 | ++ prctl -n process.max-file-descriptor -t basic -v ${ULIMIT_H} $$ || true |
| 57 | ++ fi |
| 58 | + |
| 59 | + # Make sure log directory exists |
| 60 | + mkdir -p $RUNNER_LOG_DIR |
0 commit comments