php-resque (pronounced like "rescue") is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.
← Go back to main documentation
To run a command navigate to your project root and run vendor/bin/resque
with a command, e.g.:
$ vendor/bin/resque worker:start
php-resque comes with the following commands:
worker:start
- Polls for jobs on specified queues and executes job when foundworker:stop
- Stop a running worker. If no worker id set then stops all workersworker:cancel
- Cancel job on a running worker. If no worker id set then cancels all workersworker:pause
- Pause a running worker. If no worker id set then pauses all workersworker:resume
- Resume a running worker. If no worker id is set then resumes all workersworker:restart
- Restart a running worker. If no worker id set then restarts all workersjob:queue
- Queue a new job to run with an optional delayhosts
- List all running workers on the hostlist
- Lists commandsqueues
- Get queue statisticsworkers
- List all running workers on the hostcleanup
- Cleans up php-resque data, removing dead hosts, workers, and jobsclear
- Clears all php-resque data from Redishelp
- Displays help for a commandsocket:connect
- Connects to a php-resque receiver socketsocket:receive
- Listens to the socket to receive eventssocket:send
- Sends a command to a php-resque receiver socketspeed:test
- Performs a speed test on php-resque to see how many jobs/second it can compute
To specify a configuration option use the following syntax:
$ vendor/bin/resque command --option=value
Some options can be used for any command:
config
- Path to the config file. Inline options override.include
- Path to include php file.host
- The Redis hostname.port
- The Redis port.scheme
- The Redis scheme to use.namespace
- The Redis namespace to use. This is prefixed to all keys.password
- The Redis AUTH passwordlog
- Specify the handler(s) to use for logging.events
- Outputs all events to the console, for debugging.
And here are the command specific options:
worker:start
queue
- The queue(s) to listen on, comma separated.blocking
- Use Redis pop blocking or time interval.interval
- Blocking timeout/interval speed in seconds.timeout
- Seconds a job may run before timing out.memory
- The memory limit in megabytes.pid
- Absolute path to PID file, must be writeable by the worker.
worker:stop
id
- The id of the worker to stop (optional; if not present stops all workers).force
- Force worker to stop, cancelling any current job.
worker:cancel
id
- The id of the worker to cancel its running job (optional; if not present cancels all workers).
worker:pause
id
- The id of the worker to pause (optional; if not present pauses all workers).
worker:resume
id
- The id of the worker to resume (optional; if not present resumes all workers).
worker:restart
id
- The id of the worker to restart (optional; if not present restarts all workers).
job:queue
job
- The job to run.args
- The arguments to send with the job.queue
- The queue to add the job to.delay
- The amount of time or a unix time to delay execution of job till.
clear
force
- Force without asking.
socket:connect
connecthost
- The host to connect to.connectport
- The port to connect to.connecttimeout
- The connection timeout time (seconds).
socket:receive
listenhost
- The host to listen on.listenport
- The port to listen on.listenretry
- If can't bind the address or port then retry every seconds until it can.listentimeout
- The retry timeout time (seconds).
socket:send
cmd
- The command to send to the receiver.id
- The id of the worker (optional; required for the worker: commands).connecthost
- The host to send to.connectport
- The port to send on.connecttimeout
- The send request timeout time (seconds).force
- Force the command.json
- Whether to return the response in JSON format.