如何从Perl CGI应用程序安排一次性任务? [英] How do I schedule one-time tasks from a Perl CGI application?

查看:118
本文介绍了如何从Perl CGI应用程序安排一次性任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,以允许用户从Web应用程序(Linux/Apache/CGI :: Application)安排一次长期运行的任务.为此,我使用 Schedule :: At 模块,它是"at"命令的Perl接口.由于计划的任务没有重复,因此我不考虑"cron".我的"at"有两个问题:

I am writing an application to allow users to schedule one-time long-running tasks from a web application (Linux/Apache/CGI::Application). To do this I use the the Schedule::At module which is the Perl interface to the "at" command. Since the scheduled tasks are not repeating, I am not considering "cron". I have two issues with "at" though:

  1. 当我的CGI应用程序在suexec包装器下运行时,调度工作正常,但在Apache进程的所有者进行调度时却不能正常工作.如何获得在两种环境(suexec和no-suexec)中均可使用的计划?
  2. 看来,由"at"或Schedule :: At调度的进程没有失败报告,有时我发现调度的任务会以静默方式失败.有什么方法可以记录计划的任务(而不是计划程序本身)未能运行的事实吗?

我不固定使用"at",并且愿意使用其他更强大的调度方法(如果有).

I am not fixed on "at" and am open to using other, more robust, scheduling methods if there are any.

感谢您的关注.

推荐答案

我听说过有关

I've heard good things about The Schwartz . It doesn't have a delay-until though; you'd submit the jobs via at, but that should solve both of the problems you list above, as long as your submit_job script was simple.

(作为警告,我只使用了 Gearman ,我想你是想要一个可靠的工作队列,一种解雇后忘了"的机制,这样就可以使您的Submit_job变得愚蠢.)

(as a caveat, I've only used Gearman, I think you'd want a reliable job queue for this, a "fire and forget" mechanism, so you can keep your submit_job dumb.)

这篇关于如何从Perl CGI应用程序安排一次性任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆