cron 服务是通过守护程序提供的。因此,请记住检查该守护进程是否在您的系统上运行,命令 top 即可。
My approach to similar jobs is using up cron service(in Linux/UNIX, similar to Scheduled Tasks in Windows). My virtual host service provider have provided such options in its CPanel. You may also ask your service provider for assistance. cron can do jobs in intervals down to 1 minute.
To do the job, first code some scripts which I call a trigger, e.g: trigger.php, and look up in the control panel for cron jobs. For example:
(sorry for non-English pictures)
In the middle of the panel, you can set patterns for MINUTES, HOURS, DAYS, MONTHS, YEARS and enter your COMMAND scheduled to execute. * means each, so if you set MINUTES to *(with all others left to *), it means every minute cron will run your command. If you set MINUTES to 5 with all others to *, cron will run in each hour's 5th minute. Other expressions, like setting MINUTES to */10 with HOURS as 1,5,7,9 , tells cron execute command during 1st, 5th, 7th, 9th hour of the day in which interval is 10 minutes.
cron is configurable under LINUX/UNIX shells. To do this, type
$ crontab -e
An editor will show up for modifications. Configurations are same as described above. When done, save and quit.
cron service is provided with a daemon program. So remember to check that this daemon does running on your system, command top will do.
发布评论
评论(1)
我处理类似作业的方法是使用 cron 服务(在 Linux/UNIX 中,类似于 Windows 中的计划任务)。我的虚拟主机服务提供商在其 CPanel 中提供了此类选项。您也可以向您的服务提供商寻求帮助。 cron 可以以最短 1 分钟的间隔执行作业。
为了完成这项工作,首先编写一些我称之为触发器的脚本,例如:trigger.php,然后在控制面板中查找 cron 作业。例如:
(抱歉非英文图片)
在面板中间,您可以为 分钟、小时、天、月、年并输入您的命令< /em> 预定 执行。
* 表示每个,因此如果您将 MINUTES 设置为 *(其他所有选项都保留为 *),则意味着 cron 每分钟都会运行您的命令。如果将 MINUTES 设置为 5,并将其他所有设置为 *,则 cron 将在每小时的第 5 分钟运行。其他表达式,例如将 MINUTES 设置为 */10,将 HOURS 设置为 1,5,7,9 ,告诉 cron 在第 1、5、7、9 小时执行命令间隔为 10 分钟的一天。
cron 可在 LINUX/UNIX shell 下进行配置。为此,请键入
将显示编辑器以供修改。配置与上述相同。完成后,保存并退出。
cron 服务是通过守护程序提供的。因此,请记住检查该守护进程是否在您的系统上运行,命令 top 即可。
My approach to similar jobs is using up cron service(in Linux/UNIX, similar to Scheduled Tasks in Windows). My virtual host service provider have provided such options in its CPanel. You may also ask your service provider for assistance. cron can do jobs in intervals down to 1 minute.
To do the job, first code some scripts which I call a trigger, e.g: trigger.php, and look up in the control panel for cron jobs. For example:
(sorry for non-English pictures)
In the middle of the panel, you can set patterns for MINUTES, HOURS, DAYS, MONTHS, YEARS and enter your COMMAND scheduled to execute.
* means each, so if you set MINUTES to *(with all others left to *), it means every minute cron will run your command. If you set MINUTES to 5 with all others to *, cron will run in each hour's 5th minute. Other expressions, like setting MINUTES to */10 with HOURS as 1,5,7,9 , tells cron execute command during 1st, 5th, 7th, 9th hour of the day in which interval is 10 minutes.
cron is configurable under LINUX/UNIX shells. To do this, type
An editor will show up for modifications. Configurations are same as described above. When done, save and quit.
cron service is provided with a daemon program. So remember to check that this daemon does running on your system, command top will do.