d1f8bd40
Alexey Boroda
first commit
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
[ ---Supervisor--- ]
Supervisor is process monitor for Linux. It automatically starts your console processes. For install on Ubuntu you need run command:
sudo apt-get install supervisor
Supervisor config files usually available in /etc/supervisor/conf.d. You can create any number of config files.
Config example:
[program:yii-queue-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php /var/www/my_project/yii queue/listen --verbose=1 --color=0
autostart=true
autorestart=true
user=www-data
numprocs=4
redirect_stderr=true
stdout_logfile=/var/www/my_project/log/yii-queue-worker.log
In this case Supervisor must starts 4 queue/listen workers. Worker output will write into log file.
For more info about Supervisor's configure and usage see documentation.
Worker starting in daemon mode with queue/listen command supports File, Db, Redis, RabbitMQ, Beanstalk, Gearman drivers. For additional options see driver guide.
[ ---Cron--- ]
You can start worker using cron. You have to use queue/run command. It works as long as queue contains jobs.
Config example:
* * * * * /usr/bin/php /var/www/my_project/yii queue/run
In this case cron will start the command every munute.
|