I'm using aws cfn to start ubuntu instances, and I need to pass variables provided in cfn launch script to the scripts on the instance. For example, I may pass "db-server=db-2.domain.com" and there is a number of scripts on the instance, that want to know this address.
At the moment I create a file in /etc/profile.d setting vars with
export, but this only works if bash is started as a login shell, which requires extra actions on my part to have these variables everywhere.
So I though that maybe I could instead create files in /usr/local/bin, e.g.
echo "db-2.domain.com" as content, this way they would be available to each script with no changes required.
Is it a good approach?