如何在Linux中添加cron作业
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10945806/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add a cron job in linux
提问by Altaf Hussain
I am using sphinx for searching. I get new data everyday which is added in the database.
我正在使用狮身人面像进行搜索。我每天都会收到添加到数据库中的新数据。
I have to add this data into the sphinx search index so that it can be searched. For that I need to reindex the sphinx search index at regular intervals.
我必须将此数据添加到 sphinx 搜索索引中,以便对其进行搜索。为此,我需要定期重新索引 sphinx 搜索索引。
How can I set a cron in linux to do so?
我如何在 linux 中设置一个 cron 来做到这一点?
采纳答案by fduff
a crontab is defined like this:
crontab 定义如下:
MIN HOUR DOM MON DOW CMD
so if you want to run a task on a daily basis try:
因此,如果您想每天运行一项任务,请尝试:
0 0 * * * /path/to/your/script
that will trigger the launch of your script everyday at 0:00
这将在每天 0:00 触发您的脚本的启动
For more details, see the cron tag wiki
有关更多详细信息,请参阅cron 标签 wiki