forked from jhpyle/docassemble
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sync.sh
executable file
·33 lines (28 loc) · 1.18 KB
/
sync.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
#!/bin/bash
export DA_ROOT="${DA_ROOT:-/usr/share/docassemble}"
export DAPYTHONVERSION="${DAPYTHONVERSION:-2}"
if [ "${DAPYTHONVERSION}" == "2" ]; then
export DA_DEFAULT_LOCAL="local"
else
export DA_DEFAULT_LOCAL="local3.6"
fi
export DA_ACTIVATE="${DA_PYTHON:-${DA_ROOT}/${DA_DEFAULT_LOCAL}}/bin/activate"
export DA_CONFIG_FILE="${DA_CONFIG:-${DA_ROOT}/config/config.yml}"
source /dev/stdin < <(su -c "source \"${DA_ACTIVATE}\" && python -m docassemble.base.read_config \"${DA_CONFIG_FILE}\"" www-data)
set -- $LOCALE
export LANG=$1
export CONTAINERROLE=":${CONTAINERROLE:-all}:"
export LOGDIRECTORY="${LOGDIRECTORY:-${DA_ROOT}/log}"
if [ "${DAWEBSERVER:-nginx}" = "apache" ]; then
if [[ $CONTAINERROLE =~ .*:(all):.* ]]; then
rsync -auq /var/log/apache2/ "${LOGDIRECTORY}/" && chown -R www-data.www-data "${LOGDIRECTORY}"
fi
fi
if [ "${DAWEBSERVER:-nginx}" = "nginx" ]; then
if [[ $CONTAINERROLE =~ .*:(all):.* ]]; then
rsync -auq /var/log/nginx/ "${LOGDIRECTORY}/" && chown -R www-data.www-data "${LOGDIRECTORY}"
fi
fi
if [[ $CONTAINERROLE =~ .*:(log):.* ]]; then
rsync -auq --delete "${LOGDIRECTORY}/" /var/www/html/log/ && chown -R www-data.www-data /var/www/html/log
fi