你在这里有几个问题,最重要的是让你的SSH访问建立(如你称之为“控制台访问”)。没有它,你将无法获得你的cron作业设置。
至于cron作业,你会想请按照下列步骤操作:
1)设置crontab文件,可能在你的主目录。下面是一个示例文件,让你开始:
#This file is: /home/<your-user-name>/mycronfile.cron
#Use "crontab mycronfile.cron" to reinstall this file
#Use "crontab -l" to list the contents of the current crontab
#Use man 5 crontab for info
#Format is: minute hour dayofmonth month dayofweek
# * * * * * *
# | | | | | |
# | | | | | +-- Year (range: 1900-3000)
# | | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)
# | | | +------ Month of the Year (range: 1-12)
# | | +-------- Day of the Month (range: 1-31)
# | +---------- Hour (range: 0-23)
# +------------ Minute (range: 0-59)
# , and - can be used as in 0,15,30,45 or 1-5
# run my script every WEEKDAY at 3pm
0 15 * * 1-5 php -f /Library/Developer/myscript.php
# note that it's okay to leave out Year since I'm not using it
2)安装此文件作为指导中的cron上面的例子,你的主目录:
crontab mycronfile.cron
3)确认它是由输入安装:
crontab -l
最后一点需要注意的是,在您的PHP脚本中,您不能使用$ _SERVER全局变量,因为CLI模式不支持这些全局变量。你所有的路径都必须是绝对的。
什么操作系统?你有控制台访问?您是否阅读过cron的手册? –
它在AWS上。我不确定我是否可以访问控制台。 – vbbartlett