aboutsummaryrefslogtreecommitdiff
path: root/docker/heka/extend_start.sh
blob: 6e0b2b68c2c09aa7046253532522ee79e57a721b (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
29
30
31
32
33
34
35
36
37
#!/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 [[ $(stat -c %U:%G /var/log/kolla) != "heka:kolla" ]]; then
    sudo chown heka:kolla /var/log/kolla
fi
if [[ $(stat -c %a /var/log/kolla) != "2775" ]]; then
    sudo chmod 2775 /var/log/kolla
fi

# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
    exit 0
fi

# /var/cache/hekad is what the Heka daemon will use for persistent storage
# through process restarts, so make "heka" the user of that directory.
if [[ $(stat -c %U:%G /var/cache/hekad) != "heka:heka" ]]; then
    sudo chown heka: /var/cache/hekad
fi

# Give hekad the permission to create the "log" Unix socket file in the
# /var/lib/kolla/heka directory.
if [[ $(stat -c %U:%G /var/lib/kolla/heka) != "heka:kolla" ]]; then
    sudo chown heka:kolla /var/lib/kolla/heka
fi

# The Heka daemon will create the /var/lib/kolla/heka/log Unix socket file, so
# make sure it's not present or the Heka daemon will fail when starting.
if [[ -e "/var/lib/kolla/heka/log" ]]; then
    rm -rf /var/lib/kolla/heka/log
fi