如何从 Perl CGI 应用程序安排一次性任务?

发布于 2024-07-22 03:45:15 字数 565 浏览 7 评论 0原文

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

  1. 当我的 CGI 应用程序在 suexec 包装器下运行时,调度工作正常,但当由 Apache 进程的所有者调度时则不然。 如何让调度在两种环境(suexec 和 no-suexec)中工作?
  2. 似乎由“at”或 Schedule::At 调度的进程没有故障报告,而且我有时发现调度的任务会默默地失败。 有没有某种方法可以记录计划任务(而不是调度程序本身)运行失败的事实?

我并不固定在“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 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. Scheduling works fine when my CGI application runs under the suexec wrapper, but not when scheduled by the owner of the Apache process. How can I get scheduling to work in both environments (suexec and no-suexec)?
  2. It appears that the processes scheduled by "at" or Schedule::At have no failure reporting, and I sometimes find that scheduled tasks fail silently. Is there some way to log the fact that the scheduled task (not the scheduler itself) has failed to run?

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

Thank you for your attention.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纸短情长 2024-07-29 03:45:15

我听说过关于 The Schwartz 的好消息。 但它没有延迟,直到; 您可以通过 at 提交作业,但这应该可以解决上面列出的两个问题,只要您的 Submit_job 脚本很简单。

(作为警告,我只使用了 Gearman,我想你会想要一个可靠的作业队列,一个“即发即忘”机制,这样你就可以让你的submit_job保持沉默。)

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.

(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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文