summaryrefslogtreecommitdiff
path: root/docker/fluentd/extend_start.sh
blob: 73f3d145e80ea004cf156773cfbb65508fe751ae (plain)
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
#!/bin/bash

# Give processes executed with the "kolla" group the permission to create files
# and sub-directories in the /var/log/kolla directory.
#
# Also set the setgid permission on the /var/log/kolla directory so that new
# files and sub-directories in that directory inherit its group id ("kolla").

if [[ "${KOLLA_BASE_ARCH}" == "x86_64" && "${KOLLA_BASE_DISTRO}" != "debian" ]]; then
    USERGROUP="td-agent:kolla"
    FLUENTD="td-agent"
else
    USERGROUP="fluentd:kolla"
    FLUENTD="fluentd"
fi

if [ ! -d /var/log/kolla ]; then
    mkdir -p /var/log/kolla
fi
if [[ $(stat -c %U:%G /var/log/kolla) != "${USERGROUP}" ]]; then
    sudo chown ${USERGROUP} /var/log/kolla
fi
if [[ $(stat -c %a /var/log/kolla) != "2775" ]]; then
    sudo chmod 2775 /var/log/kolla
fi
if [[ (-d /var/lib/${FLUENTD}) && ($(stat -c %U:%G /var/lib/${FLUENTD}) != "${USERGROUP}") ]]; then
    sudo chown ${USERGROUP} /var/lib/${FLUENTD}
fi