Jelastic-如何使用无效的字符来修复Bash_profile,在创建环境变量时输入?

发布于 2025-01-27 21:25:10 字数 481 浏览 1 评论 0原文

事先,我对我的英语表示歉意。 正是在研究如何解决问题的同时,我发现了Jelastic创建环境变量的建议。没有这些知识,我创建了像在Linux中创建的变量一样,如果发生错误,我可以轻松编辑Bash_profile文件。这不会在jelastic服务器上发生。 错误是,在bash_profile中声明环境变量时,我插入了错误的行。这些线产生了警告,如印刷品所示。我做了很多研究,无法弄清楚如何修复它。你能帮助我吗?

引起问题的行是: 导出backup_delete_schedule = 0 0 * * 1-5。 用命令进入终端 echo“导出backup_delete_schedule = 0 0 * * 1-5”>> 〜/.bash_profile

输入图像说明

In advance, I apologize for my English.
It was while researching how to solve the problem that I discovered Jelastic's recommendations for creating environment variables. Without this knowledge, I created variables like I create in linux, where in case of error, I can edit the bash_profile file easily. Which doesn't happen on Jelastic servers.
The error is that I inserted incorrect lines when declaring environment variables in the bash_profile. These lines generated warnings as shown in the print. I did a lot of research and couldn't figure out how to fix it. can you help me?

The line that caused the problem was:
export BACKUP_DELETE_SCHEDULE=0 0 * * 1-5.
Entered with command in terminal
echo "export BACKUP_DELETE_SCHEDULE=0 0 * * 1-5" >> ~/.bash_profile

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情深缘浅 2025-02-03 21:25:10

1。出了什么问题?

export BACKUP_DELETE_SCHEDULE=0 0 * * 1-5

被解释为类似的东西:

export BACKUP_DELETE_SCHEDULE=0
export 0
export *
export *
export 1-5

要将所有这些都放入变量中,您必须将其包装在引号上:

export BACKUP_DELETE_SCHEDULE="0 0 * * 1-5"

因此,将其附加到现有〜/.bash_profile文件将是这样的:

echo 'export BACKUP_DELETE_SCHEDULE="0 0 * * 1-5"' >> ~/.bash_profile

2。如何修复它

在Jelastic节点上,此文件故意不可编辑(仅附加):

$ lsattr .bash_profile
-----a-------e-- .bash_profile

含义:

  • 具有“ A”属性集的文件只能在附加模式下打开。
  • “ e”属性表明该文件正在使用扩展图来映射磁盘上的块。

因此,您需要要么:

  • 删除节点(并创建一个新的节点)
  • 联系您的托管提供商的支持团队,以帮助您从.bash_profile从您的问题行删除问题行,

显然,首选选项取决于您是否取决于您。是否需要该节点上的数据...

如何避免它

3。除了不犯错以后 (请参阅#1), jelastic文档描述了另一种方式 - 他们建议创建〜/.bashrc文件(如果有任何错误,您将拥有完整的编辑权限),该文件已在〜/.bash_profile中自动source

还请注意,使用.bash_profile的差异。.bashrc

  • 〜/.bash_profile仅在通过控制台登录时执行
  • 〜/.bashrc是为每个新的bash实例执行的

1. What went wrong?

export BACKUP_DELETE_SCHEDULE=0 0 * * 1-5

Is interpreted as something like:

export BACKUP_DELETE_SCHEDULE=0
export 0
export *
export *
export 1-5

To put all of that into the variable you must wrap it in quotation marks:

export BACKUP_DELETE_SCHEDULE="0 0 * * 1-5"

So appending to the existing ~/.bash_profile file would be like this:

echo 'export BACKUP_DELETE_SCHEDULE="0 0 * * 1-5"' >> ~/.bash_profile

2. How to fix it

On Jelastic nodes, this file is deliberately not editable (only append-able):

$ lsattr .bash_profile
-----a-------e-- .bash_profile

Meaning:

  • A file with the 'a' attribute set can only be opened in append mode for writing.
  • The 'e' attribute indicates that the file is using extents for mapping the blocks on disk.

Therefore you need to either:

  • delete the node (and create a new one)
  • contact your hosting provider's support team for assistance to delete the problem line(s) from your .bash_profile

Obviously the preferred option depends if you need the data on this node or not...

3. How to avoid it in future

Besides not making the mistake (see #1), the Jelastic documentation describes another way - they suggest to create a ~/.bashrc file (which you would have full permissions to edit, in case of any mistakes) which Jelastic already automatically source within ~/.bash_profile.

Please also note the differences regarding when .bash_profile is used vs. .bashrc:

  • ~/.bash_profile is executed only upon login via console
  • ~/.bashrc is executed for each new bash instance
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文