I'm trying to pass multiple commands in a conainter_commands
entry and keep getting errors. Yet when I pass the same commands as individual entries it works fine.
Works:
container_commands:
01_remove_old_dump:
command: 'rm -f /tmp/db.dump'
02_get_new_dump:
command: 'aws s3 cp s3://bucket/db.dump'
Fails with /bin/sh: rm -f /tmp/db.dump: No such file or directory.
container_commands:
01_remove_old_dump:
command: ('rm -f /tmp/db.dump' 'aws s3 cp s3://bucket/db.dump')
Never mind, I just broke the lines up with a YAML block and that works:
01_command:
command: |
if [[ ! $ENVIRONMENT = "PROD" ]] && [[ $RDS_HOSTNAME ]]
rm -f /tmp/db.dump
aws s3 cp s3://bucket/db.dump
pg_restore -H $RDS_HOSTNAME dbname /tmp/db.dump
echo "Refreshing database..."
else
Echo "Environment is ${ENVIRONMENT}. Skipping database refresh..."
fi
NOTE: Removed this, it doesn't seem to work (always returns true):
test: |
[[ ! $ENVIRONMENT = "PRODUCTION" ]] && \
[[ $RDS_HOSTNAME ]] && \
echo "Refreshing database..."