Packaging: Check if proc file exists before calling sysctl
The packaged init scripts could return an error, if the file /proc/sys/vm/max_map_count was not existing and we still called sysctl. This is primarly to prevent confusing error messages when elasticsearch is started under virtualized environments without a proc file system. Closes #4978
This commit is contained in:
parent
2bc48a4806
commit
7b64a5c2c8
|
@ -157,7 +157,7 @@ case "$1" in
|
|||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
|
||||
if [ -n "$MAX_MAP_COUNT" ]; then
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ start() {
|
|||
if [ -n "$MAX_LOCKED_MEMORY" ]; then
|
||||
ulimit -l $MAX_LOCKED_MEMORY
|
||||
fi
|
||||
if [ -n "$MAX_MAP_COUNT" ]; then
|
||||
if [ -n "$MAX_MAP_COUNT" -a -f /proc/sys/vm/max_map_count ]; then
|
||||
sysctl -q -w vm.max_map_count=$MAX_MAP_COUNT
|
||||
fi
|
||||
if [ -n "$WORK_DIR" ]; then
|
||||
|
|
Loading…
Reference in New Issue