Home  >  Article  >  Backend Development  >  Linux定时任务

Linux定时任务

WBOY
WBOYOriginal
2016-06-06 20:11:211151browse

我想每周一凌晨两点执行一个PHP文件(程序会导出一个excel),然后将这个文件自动通过邮件发送

回复内容:

我想每周一凌晨两点执行一个PHP文件(程序会导出一个excel),然后将这个文件自动通过邮件发送

可以用crontab设置定时任务,用mutt命令发送带附件的邮件。

liunx下的 crontab 服务
它支持的格式如下:
分 时 天 月 周

因此按你的需求可用下面的方式

<code>0 2 * * 1  php  index.php</code>

Linux定时任务

可以用这个网站给的工具测试写的定时规则是否符合要求
网址:http://tool.lu/crontab

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn