I feel a little bit silly for asking this question but I can't seem to find an answer on the internet for this problem. After searching for several hours I figured out that on a linux server you use Supervisor to run "php artisan queue:listen" (either with or without daemon) continuously on your website to handle jobs pushed to the queue. This is all well and good, but what if I want to do this on a Windows Azure web app? After searching around the solutions I found were:
我觉得问这个问题有点傻,但是我好像在网上找不到这个问题的答案。在搜索了几个小时之后,我发现在linux服务器上,您可以使用Supervisor在您的网站上持续运行“php artisan队列:listen”(无论是否有守护进程),以处理推送到队列中的作业。这一切都很好,但是如果我想在Windows Azure web应用程序上做这些呢?在寻找解决方案后,我发现:
- Make a chron job to run "php artisan queue:listen" every minute (or every X minutes), I really dislike this solution and wanted to avoid it specially if the site gets more traffic;
- 创建一个运行“php artisan队列:每分钟(或每X分钟)”的chron job,我真的不喜欢这个解决方案,并希望在站点获得更多流量时避免它;
- Add a WebJob that runs "php artisan queue:listen" continuously (the problem here is I don't know how to write the script for the WebJob...);
- 添加一个持续运行“php artisan队列:listen”的web作业(这里的问题是我不知道如何为web作业编写脚本…);
I want to ask you guys for help on to know which of these is the correct solution, if there is a better one and if the WebJob is the best one how do I write the script for this? Thanks in advance.
我想请你们帮助我知道哪些是正确的解决方案,如果有更好的方法,如果网络作业是最好的那我怎么写这个脚本呢?提前谢谢。
2 个解决方案
#1
2
In short, Supervisor is a modern alternative to nohup (no hang up) with a few other bits and pieces tacked on. In short, there's other resources that can keep a task running in the background (daemon) and the solution I use for Windows based projects (very few tbh) is Forever which I discovered via: https://*.com/a/18226392/5912664
简而言之,“监督者”是nohup(不挂断)的一种现代替代方案,它使用了一些其他的小部件。简而言之,还有其他资源可以让一个任务在后台运行(守护进程),我用于基于Windows的项目(很少tbh)的解决方案是永久的,我是通过https://*.com/a/18226392/5912664发现的
C:\myprojectroot > forever -c php artisan --queue:listen --tries=3
How?
如何?
Install node
for Windows, then with npm
install Forever
为Windows安装节点,然后永久安装npm
C:\myprojectroot > npm install -g forever
If you're stuck for getting Node running on Windows, I recommend the Windows Package Manager, Chocolatey
如果你在Windows上安装了Node,我推荐你使用Windows Package Manager Chocolatey
https://chocolatey.org/packages?q=node
https://chocolatey.org/packages?q=node
Be sure to check for any logfiles that Forever
creates, as I had left one long enough to consume 30Gb of disk space!
请务必检查任何永久创建的日志文件,因为我留下的日志文件足以消耗30Gb的磁盘空间!
#2
3
For Azure you can make a new webjob to your web app, and upload a .cmd file including a command like this.
对于Azure,您可以在web应用程序中创建一个新的webjob,并上传一个包含如下命令的.cmd文件。
php %HOME%\site\wwwroot\artisan queue:work --daemon
php %家里% \网站\ wwwroot \工匠队列:工作——守护进程
and defining that as a triguered and 0 * * * * * frecuency cron.
把它定义为一个三角函数和0 * * * frecuency cron。
that way work for me.
这样对我很有效。
best.
请接受我最美好的祝愿,
#1
2
In short, Supervisor is a modern alternative to nohup (no hang up) with a few other bits and pieces tacked on. In short, there's other resources that can keep a task running in the background (daemon) and the solution I use for Windows based projects (very few tbh) is Forever which I discovered via: https://*.com/a/18226392/5912664
简而言之,“监督者”是nohup(不挂断)的一种现代替代方案,它使用了一些其他的小部件。简而言之,还有其他资源可以让一个任务在后台运行(守护进程),我用于基于Windows的项目(很少tbh)的解决方案是永久的,我是通过https://*.com/a/18226392/5912664发现的
C:\myprojectroot > forever -c php artisan --queue:listen --tries=3
How?
如何?
Install node
for Windows, then with npm
install Forever
为Windows安装节点,然后永久安装npm
C:\myprojectroot > npm install -g forever
If you're stuck for getting Node running on Windows, I recommend the Windows Package Manager, Chocolatey
如果你在Windows上安装了Node,我推荐你使用Windows Package Manager Chocolatey
https://chocolatey.org/packages?q=node
https://chocolatey.org/packages?q=node
Be sure to check for any logfiles that Forever
creates, as I had left one long enough to consume 30Gb of disk space!
请务必检查任何永久创建的日志文件,因为我留下的日志文件足以消耗30Gb的磁盘空间!
#2
3
For Azure you can make a new webjob to your web app, and upload a .cmd file including a command like this.
对于Azure,您可以在web应用程序中创建一个新的webjob,并上传一个包含如下命令的.cmd文件。
php %HOME%\site\wwwroot\artisan queue:work --daemon
php %家里% \网站\ wwwroot \工匠队列:工作——守护进程
and defining that as a triguered and 0 * * * * * frecuency cron.
把它定义为一个三角函数和0 * * * frecuency cron。
that way work for me.
这样对我很有效。
best.
请接受我最美好的祝愿,