簡體   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