Reputation: 405
I am deploying Sharetribe application. Following their documentation, I need to run bundle exec rake RAILS_ENV=production jobs:work
. The problem is that after execution of this command, I need to close the SSH
connection, and to do this I have to exit jobs
process.
How can I run bundle exec rake RAILS_ENV=production jobs:work
in background?
Upvotes: 1
Views: 5719
Reputation: 11
Integration of a backgroud in stain executants at startup.
To do so, we will use [systemd].
File structure.
[Unit]
Description = Tmarket background processing daemon program
[Service]
Type = Single
ExecStart = / home / marketuser / bin / rakejob.sh
Restart = always
[Install]
WantedBy = graphical.target
export PATH = / home / marketuser / bin: /home/marketuser/.nvm/versions/node/v6.1.0/bin: /home/marketuser/.rbenv/plugins/ruby-build/bin: / home / marketuser /. rbenv / shims: /home/marketuser/.rbenv/bin: / usr / local / sbin: / usr / local / bin: / usr / sbin: / usr / bin: / sbin: / bin: / usr / games: / usr / local / games
cd / var / www / tmarket /
exec rake jobs: work
[-] The PATH is obtenur by executing the console command 'echo $ PATH' tmarket is the directory of our RoR application
Upvotes: 1
Reputation: 126
Please include the gem "daemons" to your Gemfile. And use the below command
RAILS_ENV=production script/delayed_job start
For more information please check the delayed job gem.
Upvotes: 0
Reputation: 521
You can run it like any other console command by using nohup or just adding & symbol in the end of the command, but note that solution with & will be stopped if you will close the terminal tab with it.
Upvotes: 0