Gman
Gman

Reputation: 2453

How to read Environment Properties set in AWS ElasticBeanstalk

I have set environment properties in elasticbeanstalk, Property Name: spring.profiles.active, Property Value: qa.

enter image description here

On spring application deploy this value is correctly read by using ps -aef | grep tomcat from terminal.

enter image description here

I want to be able to read this environment property in a shell script and extract the value "qa" which I use to configure other items on the server.

Is this possible and if so, how do I do it.

Upvotes: 9

Views: 795

Answers (1)

Gman
Gman

Reputation: 2453

OK I found out how to get the result I was looking for.

Here is the command:

ps -aef | grep tomcat | grep -Po 'spring.profiles.active=\K[^ ]+'

If someone has a cleaner or better way of doing this I will gladly accept it.

G

Upvotes: 5

Related Questions