繁体   English   中英

带外壳程序脚本的RAILS_ROOT

[英]RAILS_ROOT with shell script

我在lib文件夹中创建了一个shell脚本。

我想在该脚本中使用RAILS_ROOT而不是长路径。

有什么办法可以做到吗?

这是我的剧本

if ! [ -s delayed_job.pids ]; then
  RAILS_ENV=production /home/app/script/delayed_job start
fi

我想用类似的东西来修改这行。

if ! [ -s delayed_job.pids ]; then
  RAILS_ENV=production #{RAILS_ROOT}/script/delayed_job start
fi

可能吗? 怎么样 ?

run_result = `#{Rails.root}/lib/your_script_name.sh` 
# ` is backtick character in upper left corner of your keyboard below ESC

暂无
暂无

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

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