Home > php教程 > php手册 > body text

linux计划任务运行php文件的方法分享

WBOY
Release: 2016-06-13 11:30:20
Original
975 people have browsed it

创建计划任务的脚本:

dos2unix /path/to/<span filename.php 
crontab </span>-<span e 
</span><span 10</span> <span 6</span> * * * /path/to/filename.php
Copy after login
# chomod +x /path/to/filename.php
Copy after login

<span #</span><span !/usr/bin/php -q </span>
<?<span php
</span><span //</span><span 写入文件到日志log中</span>
<span file_put_contents</span>('/path/to/log', <span date</span>('Y-m-d H:i:s')."\n",<span FILE_APPEND); 
</span><span //</span><span by www.jbxue.com</span>
?>
Copy after login

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!