简体   繁体   中英

RAILS_ROOT with shell script

I have created one shell script in my lib folder.

And i want to use RAILS_ROOT in that script instead of the long path.

Is there any way i can do this?

This my script

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

I want to modified this line with something like that.

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

Is it possible? How ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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