2

I'm trying to use resque as a job runner for Rails. I've tried this config, and many other ways of demonizing the rescue task (because running rake resque:work leaves the terminal tied to that command). Unfortunately, their example configuration doesn't work for me. Does the configuration look correct? Or is there another way to turn the process into a daemon? Thank you :)

check process resque_worker_QUEUE
  with pidfile /data/APP_NAME/current/tmp/pids/resque_worker_QUEUE.pid
  start program = "/bin/sh -c 'cd /data/APP_NAME/current; RAILS_ENV=production QUEUE=queue_name VERBOSE=1 nohup rake environment resque:work& > log/resque_worker_QUEUE.log && echo $! > tmp/pids/resque_worker_QUEUE.pid'" as uid deploy and gid deploy
  stop program = "/bin/sh -c 'cd /data/APP_NAME/current && kill -s QUIT `cat tmp/pids/resque_worker_QUEUE.pid` && rm -f tmp/pids/resque_worker_QUEUE.pid; exit 0;'"
  if totalmem is greater than 300 MB for 10 cycles then restart  # eating up memory?
Alex
  • 29
  • 2
  • From the FAQ /usr/share/doc/monit: How to debug monit: a) start monit; b) stop the service you want to monitor; c) run strace -f -p $(cat ~/.monit.pid) 2>&1|tee trace.out d) wait for monit to wake up and try to start the service; e) if you can see a line like this in the trace console with the significant = 0 at the end, it means monit tried to start the service: "execve("/etc/init.d/sshd", ["/etc/init.d/sshd", "start"], [/* 1 var */]) = 0" ( int this case the service is sshd). – natxo asenjo Nov 02 '10 at 07:35
  • what distro are you using? – Mike Feb 04 '12 at 19:31

1 Answers1

1

if you want to run it as a daemon, take a loot at supervisor. Most distributions ship it directly from their package repositories.

Fladi
  • 850
  • 4
  • 7