简体   繁体   中英

With PHP & AWS Elastic Beanstalk, is it possible to parse out the running version string?

I have a PHP app deployed on elastic beanstalk, from the elastic beanstalk console I can see that it is running the version: git-c3d68f38ddac47c07c2ad3845263a00fec932ca5-1372883085226. Is it possible to get this value in my application, so I can use it for things like tagging records that are created with this version of the app?

Data is available on disk. Try this.

$ grep "\"url\":" /var/lib/cfn-init/data/metadata.json | awk -F'%2F' '{print $7}' |cut -d\? -f1
git-f7b43783dbb1451bfa96751173d50b65ea839c18-1373117501122

For php, you can do something like:

<?php

$script = 'grep "\"url\":" /var/lib/cfn-init/data/metadata.json | awk -F\'%2F\' \'{print $7}\' |cut -d\? -f1';
exec($script, $output);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM