简体   繁体   English

从Ruby脚本开始领班

[英]Start foreman from a Ruby Script

I just created a script/run in my project in the following way: 我只是通过以下方式在项目中创建了一个脚本/运行:

#!/usr/bin/env ruby
# set some ENV variables..
`foreman start -f Procfile.dev`

So, I have some questions: 所以,我有一些问题:

  1. If I set a ENV["EMAIL_USERNAME"] from the ruby script, will rails be able to read it? 如果我从ruby脚本中设置了ENV["EMAIL_USERNAME"] ,rails是否可以读取它?
  2. Running foreman in that way seems like doens't work. 以这种方式运行工头似乎无效。 It just stuck. 它只是卡住了。 Is there another way? 还有另一种方法吗?

Yeah, I do know that I cant export a ENV variable to PATH, but I wish I can made the variable be exported to the app only. 是的,我确实知道我不能将ENV变量导出到PATH,但我希望可以将变量仅导出到应用程序。

PS: It could be in bash too. PS:也可能会受到打击。

Well, I made it work following glenn jackman's link: Spawn a background process in Ruby 好吧,我按照glenn jackman的链接进行了工作: 在Ruby中生成后台进程

Just call exec instead of put the command between ` 只需调用exec而不是将命令放在`之间

Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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