-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.sh
41 lines (32 loc) · 1.17 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/dumb-init /bin/bash
uid=${FLUENT_UID:-1000}
# check if a old fluent user exists and delete it
cat /etc/passwd | grep fluent
if [ $? -eq 0 ]; then
deluser fluent
fi
# (re)add the fluent user with $FLUENT_UID
useradd -u ${uid} -o -c "" -m fluent
export HOME=/home/fluent
# chown home and data folder
chown -R fluent /home/fluent
chown -R fluent /fluentd
set -e
# Seting dynamic variable
if [[ -z ${FLUENT_ELASTICSEARCH_USER} ]] ; then
sed -i '/FLUENT_ELASTICSEARCH_USER/d' /fluentd/etc/${FLUENTD_CONF}
else
sed -i "s/FLUENT_ELASTICSEARCH_USER/$FLUENT_ELASTICSEARCH_USER/g" /fluentd/etc/${FLUENTD_CONF}
fi
if [[ -z ${FLUENT_ELASTICSEARCH_PASSWORD} ]] ; then
sed -i '/FLUENT_ELASTICSEARCH_PASSWORD/d' /fluentd/etc/${FLUENTD_CONF}
else
sed -i "s/FLUENT_ELASTICSEARCH_PASSWORD/$FLUENT_ELASTICSEARCH_PASSWORD/g" /fluentd/etc/${FLUENTD_CONF}
fi
if [[ -n ${FLUENT_ELASTICSEARCH_HOST} ]]; then
sed -i "s/FLUENT_ELASTICSEARCH_HOST/$FLUENT_ELASTICSEARCH_HOST/g" /fluentd/etc/${FLUENTD_CONF}
fi
if [[ -n ${FLUENT_ELASTICSEARCH_PORT} ]]; then
sed -i "s/FLUENT_ELASTICSEARCH_PORT/$FLUENT_ELASTICSEARCH_PORT/g" /fluentd/etc/${FLUENTD_CONF}
fi
exec gosu root "$@"