2010-06-23 124 views
0

我在lib文件夹中创建了一个shell脚本。带外壳脚本的RAILS_ROOT

我想在该脚本中使用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 

这可能吗?怎么样 ?

回答

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