0

PHP-Resque workers can be started from a script with something like

passthru("nohup php " . __RESQUE_BIN__ . " >> " . __RESQUE_LOG__ . " 2>&1 &");

But how do i pause them, or stop them from a php script ?

1 Answers1

1

Check the README, you can send signals to worker processes to do what you ask:

  • QUIT - Wait for child to finish processing then exit
  • TERM / INT - Immediately kill child then exit
  • USR1 - Immediately kill child but don't exit
  • USR2 - Pause worker, no new jobs will be processed
  • CONT - Resume worker.

You will need the pid of the worker, you can send a signal with posix_kill

Paul Dixon
  • 295,876
  • 54
  • 310
  • 348
  • Yes, I did try kill -quit pid , but it works only sometimes and does not work sometimes, any clues ? – user2331173 May 26 '13 at 09:04
  • and what's the response to the kill command when it does not work ? Process ID does not exists ? No permission ? Or a job is still processing ? – Wa0x6e Jun 03 '13 at 19:51