设置 cron 作业为绝对路径
我正在使用MVC框架。现在我想设置 cron 以便执行 URL“http://www.xyz.com/controllera/functiona”。我应该在它的路径部分写什么。
我得到了一些关于“GET”命令的信息,但还不清楚。
有人可以帮我吗?
I am using MVC framework. Now I want to set up cron such that the URL "http://www.xyz.com/controllera/functiona" should be executed. what should i write in the path section for it.
I got something about "GET" command but it wasnt clear.
Can someone please help me out with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您没有指定任何框架,运行此 cron 的唯一方法是此命令,
我假设您正在使用 MVC 框架,因为
controllera
位于 url 中。如果它是 Kohana (2.3) 框架,我会通过大多数框架运行它,大多数框架都有 cli 接口来运行控制器方法。搜索您的框架。
请参阅这些链接了解不同的框架。
As you didn't specify any framework the only way to run this cron is this command
I assume you are using an MVC framework as
controllera
is in the url. If it was Kohana (2.3) framework I would have run it byMost framework has cli interface to run a controller method. Search for your framework.
See these links for different frameworks.
我不明白你问题中的“名为 cron 的模块”部分。我相信您很困惑,
cron
是 Linux 和其他 Unix 系统上通过crontab
配置的服务。crontab(5) 条目由时间和日期以及要运行的命令定义。
在 Linux 和 Posix 系统上,您无法执行或运行 URL。运行某些内容涉及 execve(2) 系统调用,它需要一个可执行文件路径(并且论据)。
也许您想使用 HTTP 协议检索某些 URL。您可以使用命令行 HTTP 客户端,例如
wget
或curl
。因此,也许您想要在 crontab 中运行的命令可能是
,但您可以使用 curl
我的猜测是说明您很困惑,并且不太理解您的问题。考虑阅读一些材料。
例如,要每天下午 3 点检索该 URL 一次,您将具有以下 crontab 条目:
使用 crontab(1) 命令来配置您的 crontab(它可能包含多个条目和多个变量定义,因此您可能需要对其进行编辑)。
I don't understand the "module called cron" part of your question. I believe you are confused,
cron
is a service on Linux and other Unix systems configured thrucrontab
.A crontab(5) entry is defined by a time and date and a command to run.
On Linux and Posix systems, you cannot execute or run an URL. Running something involves the execve(2) system call, which requires an executable file path (and arguments).
Perhaps you want to retrieve some URL using the HTTP protocol. You might use a command-line HTTP client, like
wget
orcurl
.So perhaps the command you want to run in your crontab might be
but you could use curl
My guess is that you are confused, and don't understand well enough your question. Consider reading some material.
For example, to retrieve that URL once a day at 3 pm, you would have the following crontab entry:
Use the crontab(1) command to configure your crontab (which may contain several entries, and several variable definitions, so you may have to edit it).