This is my command
bundle exec rake resque:work QUEUE="*" --trace
I want to run this command on my server as a background process.
please help me.
This is my command
bundle exec rake resque:work QUEUE="*" --trace
I want to run this command on my server as a background process.
please help me.
A method I often use is:
nohup bundle exec rake resque:work QUEUE="*" --trace > rake.out 2>&1 &
This will keep the task running even if you exit your shell. Then if I want to just observe trace output live, I do:
tail -f rake.out
And you can examine rake.out at any time.
If you need to kill it before completion, you can find it with ps
and kill the pid.
nohup bundle exec rake pr:monitor --trace > monitor.out 2>&1 &
. When I tail -f monitor.out
, I get ** Invoke pr:monitor (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute pr:monitor
–
Jeffereyjefferies nohup
and without the > monitor.out 2>&1 &
do you get any more output than that? Maybe it's an issue with the rake
task? Perhaps you should open a stackoverflow.com question for the issue. –
Bonnard ps
doesn't give the background task. So how to kill it? –
Meninges Just in case somebody finds this 4 years later, bundle has an elegant way of doing this now. For example if you want to run sidekiq in the background you can do:
bundle exec sidekiq -e production -d -L ./log/sidekiq.log
The -d
daemonizes to run in the background, but you will also need to use the -L
to provide a logfile, else bundler will refuse to run your command in the background (deamonize).
Tested with bundler version 1.15.4
Update Oct 2019. While the command still works in general, the specific command above will no longer work for sidekiq 6.0+, you'll need to use Upstart or Systemd if you use Linux: https://github.com/mperham/sidekiq/wiki/Deployment#running-your-own-process
© 2022 - 2024 — McMap. All rights reserved.
tail -f rake.out
does not show me the console output from the rake process. How to see the console output? – Jeffereyjefferies