Skip to content

Commit 61c6075

Browse files
change mkdir in elasticsearch.Debian init script to take in account when DATA_DIR, LOG_DIR and/or WORK_DIR is an empty variable
1 parent a93350b commit 61c6075

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

templates/etc/init.d/elasticsearch.Debian.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ case "$1" in
149149
fi
150150

151151
# Prepare environment
152-
mkdir -p "$LOG_DIR" "$DATA_DIR" "$WORK_DIR" && chown "$ES_USER":"$ES_GROUP" "$LOG_DIR" "$DATA_DIR" "$WORK_DIR"
152+
for DIR in "$DATA_DIR" "$LOG_DIR" "$WORK_DIR"; do
153+
[ ! -z "$DIR" ] && mkdir -p "$DIR" && chown "$ES_USER":"$ES_GROUP" "$DIR"
154+
done
153155
touch "$PID_FILE" && chown "$ES_USER":"$ES_GROUP" "$PID_FILE"
154156

155157
if [ -n "$MAX_OPEN_FILES" ]; then

0 commit comments

Comments
 (0)