如何在服务器端安排PHP脚本的执行?
2022-08-30 19:37:40
我需要一个PHP脚本在特定时间自动执行。我将如何实现这一目标?
如果您使用 crontab -e 手动编辑 crontab,或者使用 crontab -l 列出它,下面会显示一个有用的注释,放在 crontab 的顶部。
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * command to be executed
30 3 * * * php /home/scripts/do_something.php