2
2
3
3
ENV_CONF=/etc/php5/fpm/pool.d/env.conf
4
4
5
+ ENV_CRON=/etc/cron.d/drupal
6
+
7
+ # Force deletion and creation of new file
8
+ rm -f $ENV_CRON
9
+
5
10
echo " Configuring Nginx and PHP5-FPM with environment variables"
6
11
7
12
# Update php5-fpm with access to Docker environment variables
@@ -10,6 +15,7 @@ for var in $(env | awk -F= '{print $1}')
10
15
do
11
16
echo " Adding variable {$var }"
12
17
echo " env[${var} ] = ${! var} " >> $ENV_CONF
18
+ echo " ${var} =${! var} " >> $ENV_CRON
13
19
done
14
20
15
21
# We need to configure the /etc/hosts file so sendmail works properly
@@ -35,5 +41,73 @@ echo "ff00::0 ip6-mcastprefix" >> /etc/hosts
35
41
echo " ff02::1 ip6-allnodes" >> /etc/hosts
36
42
echo " ff02::2 ip6-allrouters" >> /etc/hosts
37
43
44
+ # Setting up drush cron to run according CRON_SCHEDULE or 15 min by default
45
+ if [[ -z $CRON_SCHEDULE ]]; then
46
+ CRON_SCHEDULE=" */15 * * * *"
47
+ else
48
+ echo " CRON setup to user input"
49
+ fi
50
+
51
+ # Checking if the cron is already set up
52
+ # Cron job written according http://www.drush.org/en/master/cron/
53
+ CRON_JOB=" root /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin COLUMNS=72 /usr/local/bin/drush --root=/var/www cron"
54
+ CHECK=$( cat /etc/crontab | grep -o " $CRON_JOB " )
55
+
56
+ if [[ -z $CHECK ]]; then
57
+ echo " $CRON_SCHEDULE $CRON_JOB " >> /etc/cron.d/drupal
58
+ echo " $( date " +%Y-%m-%d %H:%M:%S" ) CRON_JOB set in /etc/crontab" >> /var/log/supervisor/cron.log
59
+ else
60
+ echo " $( date " +%Y-%m-%d %H:%M:%S" ) CRON_JOB already created, doing nothing..." >> /var/log/supervisor/cron.log
61
+ fi
62
+
63
+ # Adding .htaccess to sites/default/files/ and /tmp according https://www.drupal.org/SA-CORE-2013-003
64
+
65
+ FILES_HTACCESS=" # Turn off all options we don't need.
66
+ Options None
67
+ Options +FollowSymLinks
68
+
69
+ # Set the catch-all handler to prevent scripts from being executed.
70
+ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
71
+ <Files *>
72
+ # Override the handler again if we're run later in the evaluation list.
73
+ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
74
+ </Files>
75
+
76
+ # If we know how to do it safely, disable the PHP engine entirely.
77
+ <IfModule mod_php5.c>
78
+ php_flag engine off
79
+ </IfModule>"
80
+
81
+ TMP_HTACCESS=" # Turn off all options we don't need.
82
+ Options None
83
+ Options +FollowSymLinks
84
+
85
+ # Set the catch-all handler to prevent scripts from being executed.
86
+ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
87
+ <Files *>
88
+ # Override the handler again if we're run later in the evaluation list.
89
+ SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
90
+ </Files>
91
+
92
+ # If we know how to do it safely, disable the PHP engine entirely.
93
+ <IfModule mod_php5.c>
94
+ php_flag engine off
95
+ </IfModule>
96
+ Deny from all"
97
+
98
+ # Checking files/.htaccess
99
+ if [[ -e /var/www/sites/default/files/.htaccess ]]; then
100
+ echo " File already exists"
101
+ else
102
+ echo " $FILES_HTACCESS " > /var/www/sites/default/files/.htaccess
103
+ fi
104
+
105
+ # Checking /tmp/.htaccess
106
+ if [[ -e /tmp/.htaccess ]]; then
107
+ echo " File already exists"
108
+ else
109
+ echo " $TMP_HTACCESS " > /tmp/.htaccess
110
+ fi
111
+
38
112
# Runnning supervisor
39
- /usr/bin/supervisord -n
113
+ /usr/bin/supervisord -n
0 commit comments