This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
run.sh
52 lines (45 loc) · 1.56 KB
/
run.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
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
autoremoval() {
while true; do
sleep 60
if [[ $(df -h /etc/opt/kerberosio/capture | tail -1 | awk -F' ' '{ print $5/1 }' | tr ['%'] ["0"]) -gt 90 ]];
then
echo "Cleaning disk"
find /etc/opt/kerberosio/capture/ -type f | sort | head -n 100 | xargs rm;
fi;
done
}
copyConfigFiles() {
# Check if the config dir is empty, this can happen due to mapping
# an empty filesystem to the volume.
TEMPLATE_DIR=/etc/opt/kerberosio/template
CONFIG_DIR=/etc/opt/kerberosio/config
if [ "$(ls -A $CONFIG_DIR)" ]; then
echo "Config files are available."
else
echo "Config files are missing, copying from template."
cp /etc/opt/kerberosio/template/* /etc/opt/kerberosio/config/
chmod -R 777 /etc/opt/kerberosio/config
fi
# Do the same for the web config
TEMPLATE_DIR=/var/www/web/template
CONFIG_DIR=/var/www/web/config
if [ "$(ls -A $CONFIG_DIR)" ]; then
echo "Config files are available."
else
echo "Config files are missing, copying from template."
cp /var/www/web/template/* /var/www/web/config/
chmod -R 777 /var/www/web/config
fi
}
# replace SESSION_COOKIE_NAME
random=$((1+RANDOM%10000))
sed -i -e "s/kerberosio_session/kerberosio_session_$random/" /var/www/web/.env
autoremoval &
copyConfigFiles &
# changes for php 7.1
echo "[www]" > /etc/php/7.1/fpm/pool.d/env.conf
echo "" >> /etc/php/7.1/fpm/pool.d/env.conf
env | grep "KERBEROSIO_" | sed "s/\(.*\)=\(.*\)/env[\1]='\2'/" >> /etc/php/7.1/fpm/pool.d/env.conf
service php7.1-fpm start
/usr/bin/supervisord -n -c /etc/supervisord.conf