I have a large shell script I'm trying to append to bashprofile on VM bootup:
I want this script to get appended to the bashrc
file. I've tried the following:
read -d '' load_script << EOF
// code here
EOF
but it starts evaluating the variables automatically, I just want to push this script into the bashrc file. How can I do this?
Script
writer_endpoint=$(aws neptune describe-db-clusters --db-cluster-identifier redacted | jq .DBClusters[0] | jq .Endpoint | tr -d '"')
reader_endpoint=$(aws neptune describe-db-clusters --db-cluster-identifier redacted | jq .DBClusters[0] | jq .ReaderEndpoint| tr -d '"')
writer_endpoint_status=$(awscurl https://$writer_endpoint:8182/status --service neptune-db | jq .status)
reader_endpoint_status=$(awscurl https://$reader_endpoint:8182/status --service neptune-db | jq .status)
cat << EOF
+==========+===============+
| Endpoint | Health Status |
+==========+===============+
| Reader | $writer_endpoint_status |
+----------+---------------+
| Writer | $reader_endpoint_status |
+----------+---------------+
********************************************************************************************************
Welcome to the bastion host, used to debug connectivity and queries against the Neptune graph DB.
********************************************************************************************************
[Reader Endpoint]:
$reader_endpoint
[Writer Endpoint]:
$writer_endpoint
[Example - Check status of reader replica]:
awscurl https://$writer_endpoint:8182/status --service neptune-db
*******************************************************************************************************