11#! /bin/sh
22
3- ln -s /dev/stdout /var/log/php82/error.log
4- ln -s /dev/stdout /var/log/nginx/access.log
5- ln -s /dev/stdout /var/log/nginx/error.log
6-
73if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
84 cat > /etc/phpmyadmin/config.secret.inc.php << EOT
95<?php
@@ -15,6 +11,51 @@ if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
1511 touch /etc/phpmyadmin/config.user.inc.php
1612fi
1713
18- php-fpm82
14+ ln -s /dev/stdout /var/log/unit.log
15+ ln -s /dev/stdout /var/log/unit/access.log
16+
17+ if [ " $1 " = " unitd" ] || [ " $1 " = " unitd-debug" ]; then
18+ if /usr/bin/find " /var/lib/unit/" -mindepth 1 -print -quit 2> /dev/null | /bin/grep -q . ; then
19+ echo " $0 : /var/lib/unit/ is not empty, skipping initial configuration..."
20+ else
21+ echo " $0 : Launching Unit daemon to perform initial configuration..."
22+ /usr/sbin/$1 --control unix:/var/run/control.unit.sock
23+
24+ for i in $( /usr/bin/seq $WAITLOOPS ) ; do
25+ if [ ! -S /var/run/control.unit.sock ]; then
26+ echo " $0 : Waiting for control socket to be created..."
27+ /bin/sleep $SLEEPSEC
28+ else
29+ break
30+ fi
31+ done
32+ # even when the control socket exists, it does not mean unit has finished initialisation
33+ # this curl call will get a reply once unit is fully launched
34+ /usr/bin/curl -s -X GET --unix-socket /var/run/control.unit.sock http://localhost/
35+
36+ curl -X PUT --data-binary @/config/unit.json --unix-socket \
37+ /var/run/control.unit.sock http://localhost/config/
38+
39+ echo " $0 : Stopping Unit daemon after initial configuration..."
40+ kill -TERM $( /bin/cat /var/run/unit.pid)
41+
42+ for i in $( /usr/bin/seq $WAITLOOPS ) ; do
43+ if [ -S /var/run/control.unit.sock ]; then
44+ echo " $0 : Waiting for control socket to be removed..."
45+ /bin/sleep $SLEEPSEC
46+ else
47+ break
48+ fi
49+ done
50+ if [ -S /var/run/control.unit.sock ]; then
51+ kill -KILL $( /bin/cat /var/run/unit.pid)
52+ rm -f /var/run/control.unit.sock
53+ fi
54+
55+ echo
56+ echo " $0 : Unit initial configuration complete; ready for start up..."
57+ echo
58+ fi
59+ fi
1960
2061exec " $@ "
0 commit comments