Skip to content

Commit a17a847

Browse files
authored
Merge pull request voxpupuli#708 from sp-joseluis-ledesma/debian-mkdir-init.d
Change mkdir in elasticsearch.Debian init script to take in account when DATA_DIR, LOG_DIR and/or WORK_DIR is an empty variable
2 parents 375dc2f + 686783a commit a17a847

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* The service systemd unit now `Wants=` a network target to fix bootup parallelization problems.
1010
* Recursively create the logdir for elasticsearch when creating multiple instances
1111
* Files and directories with root ownership now specify UID/GID 0 instead to improve compatability with *BSDs.
12+
* Elasticsearch Debian init file changed to avoid throwing errors when DATA_DIR, WORK_DIR and/or LOG_DIR were an empty variable.
1213

1314
#### Changes
1415
* The `api_ca_file` and `api_ca_path` parameters have been added to support custom CA bundles for API access.

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)