Skip to content

Commit 2555a59

Browse files
committed
Fixed crontab and logging bug in docker
1 parent 79b6cc8 commit 2555a59

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ RUN phpize \
3232

3333
WORKDIR /var/www/html
3434
COPY . phpredmin/
35-
RUN mkdir phpredmin/logs && chown www-data:www-data phpredmin/logs -R
35+
36+
ENV PHPREDMIN_LOG_DRIVER="std"
37+
ENV PHPREDMIN_LOG_THRESHOLD="4"
3638

3739
WORKDIR /var/www/html/phpredmin/public
3840

docker/crontab

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Cron tab for phpredmin to collect redis statistics
2-
* * * * * root cd /var/www/html/phpredmin/public && /usr/local/bin/php index.php cron/index
2+
* * * * * root . /root/.profile; cd /var/www/html/phpredmin/public && /usr/local/bin/php index.php cron/index > /dev/stdout 2>&1

docker/php.ini

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
variables_order = "EGPCS"
2+
log_errors = On
3+
error_log = /dev/stderr

docker/start.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#! /bin/sh
22

3+
# Copy PHPREDMIN env variables to .profile for cron jobs
4+
printenv | grep PHPREDMIN | xargs -rl echo "export$1" >> $HOME/.profile
5+
36
# Run gearman job server
47
gearmand -d
58
# Run cron daemon
69
cron
7-
# Run gearman work
8-
php index.php gearman/index &
9-
# Start web server
10-
apache2-foreground &
1110

11+
# Trap sigkill
1212
trap "pkill gearmand && pkill -WINCH apache2" TERM
1313

14-
wait
14+
# Run gearman work & Start web server
15+
php index.php gearman/index & apache2-foreground

0 commit comments

Comments
 (0)