github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/terraform-packer-example/user-data/user-data.sh (about)

     1  #!/bin/bash
     2  # This script is meant to be run in the User Data of an EC2 Instance while it's booting. It starts a Ruby web app.
     3  # This script assumes it is running in an AMI built from the Packer template
     4  # in examples/packer-docker-example/build.json.
     5  
     6  set -e
     7  
     8  # Send the log output from this script to user-data.log, syslog, and the console
     9  # From: https://alestic.com/2010/12/ec2-user-data-output/
    10  exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
    11  
    12  # The variables below are filled in using Terraform interpolation
    13  nohup ruby /home/ubuntu/app.rb "${instance_port}" "${instance_text}" &