Issue
I'm currently trying to install a package on an Amazon Linux EC2 server. I am trying to use an ebextensions file to set yum-cron to look for package updates daily, but I'm fairly confident that I'm not doing it correctly.
Here's the code in my .config file:
commands:
01do_update_yum:
command: yum -y update
02install_clamAV:
command: yum -y install clamav clamd
03install_yum_cron:
command: yum -y install yum-cron
04install_gedit:
command: yum -y install gedit
05set_crontab_daily_update:
command: -c "gedit /etc/yum/yum-cron.conf"
06change_apply_updates:
command: apply_updates = yes
Unless I'm missing something, steps 4 through 6 are not going to work without the user (me) running them. Basically, what I'm wondering, is if anyone knows how I can do what I'm trying to do, but within my .config file.
Thanks so much! -Matt
Solution
You need to change your script so the first line reads container_commands
.
Here's an example I deploy with our builds:
container_commands:
yum_update:
command: yum update -y
ignoreErrors: true
install_mysql:
command: yum install -y mysql
install_mlocate:
command: yum install -y mlocate
ignoreErrors: true
update_db:
command: updatedb
ignoreErrors: true
install_expect:
command: yum install -y expect
See also this example snippet from the AWS docs
container_commands:
collectstatic:
command: "django-admin.py collectstatic --noinput"
01syncdb:
command: "django-admin.py syncdb --noinput"
leader_only: true
02migrate:
command: "django-admin.py migrate"
leader_only: true
99customize:
command: "scripts/customize.sh"
Answered By - eustachio Answer Checked By - Mildred Charles (WPSolving Admin)