如何在Elastic Beanstalk上添加PATH

编程入门 行业动态 更新时间:2024-10-24 02:31:08
本文介绍了如何在Elastic Beanstalk上添加PATH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在eb deploy上的软件包中添加PATH. 程序包已安装到/var/www/html/vendor/bin

I want to add PATH to packages on eb deploy. Packages are Installed to /var/www/html/vendor/bin

可以通过SSH手动添加,但是如何添加带有配置文件的PATH.

It can be add by manually through SSH, but how can I add PATH with config file.

我有这样的配置文件.ebextensions/ec2.config. 01-set_timezone正常工作02-set_path没有

I have config file like this .ebextensions/ec2.config. 01-set_timezone works fine 02-set_path dosen't

commands: 01-set_timezone: command: cp /usr/share/zoneinfo/Japan /etc/localtime 02-set_path: command: export PATH=$PATH:/var/www/html/vendor/bin

推荐答案

每个命令都在其自己的shell中执行.因此导出将无法正常进行.您需要将其放入~/.bash_profile中,以确保每个新命令都可以执行它.

each command is performed in its own shell. so the export won't work. you'd need to put it into ~/.bash_profile to ensure it's executed with every new command.

commands: set_path: test: test ! -f /opt/elasticbeanstalk/.post-provisioning-complete command: echo 'export PATH=$PATH:/var/www/html/vendor/bin' >> /root/.bash_profile

要使其仅运行一次,请添加以下文件:

to make it run only once, add the following file:

.ebextensions/99_finalize_setup.config:

.ebextensions/99_finalize_setup.config:

commands: 99_write_post_provisioning_complete_file: command: touch /opt/elasticbeanstalk/.post-provisioning-complete

更多推荐

如何在Elastic Beanstalk上添加PATH

本文发布于:2023-05-31 10:05:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/389554.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Elastic   PATH   Beanstalk

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!