简体   繁体   English

如何在我的Amazon EC2服务器中定期运行php作业?

[英]How to run php jobs regularly in my Amazon EC2 server?

I have a Amazon EC2 server. 我有一台Amazon EC2服务器。
And I would like to run php jobs every 1 hours to get the latest information from websites and insert them into database. 而且我想每1小时运行php作业,以从网站获取最新信息并将其插入数据库。
But I am not good at server. 但是我不擅长服务器。
Any suggestions? 有什么建议么?

From this URL , you call crontab from the shell and to execute every hour, add the "00" at the beginning, point to the location of PHP and the script you want to run. 从该URL中 ,您从外壳程序调用crontab并每小时执行一次,请在开头添加“ 00”,指向PHP的位置以及要运行的脚本。

# crontab -e
00 * * * * /usr/local/bin/php /home/dir/myscript.php

As for any Linux server, use crontab. 对于任何Linux服务器,请使用crontab。

On the terminal (SSH) : 在终端(SSH)上:

crontab -e

See the man page for cron 请参阅cron的手册页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM