如何设置 cron 在特定时间只运行一次文件? [英] How do I set up cron to run a file just once at a specific time?
问题描述
如何设置 cron
在特定时间只运行一次文件?替代方法之一是 at
但它无法访问对于标准托管计划的所有用户.因此我想知道是否有办法使用 cron
来做到这一点?
How do I set up cron
to run a file just once at a specific time? One of the alternatives is at
but it is not accessible to all users on standard hosting plans. Therefore I was wondering whether there is way to do it using cron
?
推荐答案
尝试在 2011 年 3 月 30 日午夜执行命令:
Try this out to execute a command on 30th March 2011 at midnight:
0 0 30 3 ? 2011 /command
警告:如评论中所述,cron 的标准/默认实现不支持 year 列.请参阅TomOnTime 答案,了解在未来的特定时间在标准实现中运行脚本的正确方法定时任务.
WARNING: As noted in comments, the year column is not supported in standard/default implementations of cron. Please refer to TomOnTime answer below, for a proper way to run a script at a specific time in the future in standard implementations of cron.
这篇关于如何设置 cron 在特定时间只运行一次文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!