Skip to content

Commit

Permalink
Merge pull request #45 from aws-samples/fix-missing-cronjob
Browse files Browse the repository at this point in the history
Fix missing cronjob
  • Loading branch information
vrioux authored Aug 2, 2023
2 parents af1474a + c3aef3f commit c81b013
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
24 changes: 6 additions & 18 deletions templates/03-pipelinehelper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -634,32 +634,20 @@ Resources:
sudo yum install -y php-pecl-memcached
sudo yum remove -y php-pecl-memcached
sudo yum install -y php-redis

sudo yum install -y openssl11

if [ $(uname -a | grep -c x86_64) == "1" ]; then
echo "downloading x86 client for ElastiCache"
wget -P /tmp/ https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-8.0/latest-64bit-X86-openssl3
tar -xf '/tmp/latest-64bit-X86-openssl3'
wget -P /tmp/ https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-8.0/latest-64bit-X86-openssl1.1
tar -xf '/tmp/latest-64bit-X86-openssl1.1'
else
echo "downloading ARM-64 client for ElastiCache"
wget -P /tmp/ https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-8.0/latest-64bit-arm-openssl3
tar -xf '/tmp/latest-64bit-arm-openssl3'
wget -P /tmp/ https://elasticache-downloads.s3.amazonaws.com/ClusterClient/PHP-8.0/latest-64bit-arm-openssl1.1
tar -xf '/tmp/latest-64bit-arm-openssl1.1'
fi

cp 'amazon-elasticache-cluster-client.so' /usr/lib64/php/modules/
if [ ! -f /etc/php.d/50-memcached.ini ]; then
touch /etc/php.d/50-memcached.ini
fi
echo 'extension=/usr/lib64/php/modules/amazon-elasticache-cluster-client.so;' >> /etc/php.d/50-memcached.ini
echo 'extension=igbinary.so;' >> /etc/php.d/50-memcached.ini

if [ ! -f /etc/php.d/20-redis.ini ]; then
touch /etc/php.d/20-redis.ini
fi
echo 'extension=/usr/lib64/php/modules/amazon-elasticache-cluster-client.so;' >> /etc/php.d/20-redis.ini
echo 'extension=igbinary.so;' >> /etc/php.d/20-redis.ini


echo 'extension=amazon-elasticache-cluster-client.so;' > /etc/php.d/50-elasticache.ini
mode: 000500
owner: root
group: root
Expand Down
15 changes: 15 additions & 0 deletions templates/04-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ Resources:
- install_codedeploy
- install_webserver
- start_webserver
- add_crontab
install_logs:
packages:
yum:
Expand Down Expand Up @@ -470,6 +471,20 @@ Resources:
httpd:
enabled: true
ensureRunning: true
add_crontab:
files:
/tmp/add_crontab.sh:
content: !Sub |
#!/bin/sh -xe
echo "* * * * * apache /usr/bin/php /var/www/moodle/html/admin/cli/cron.php" > /etc/cron.d/moodle
mode: 000500
owner: root
group: root
commands:
add_crontab:
command: ./add_crontab.sh
cwd: /tmp
ignoreErrors: false
Properties:
LaunchTemplateData:
BlockDeviceMappings:
Expand Down

0 comments on commit c81b013

Please sign in to comment.